A Programmer's Challenge |

What Is the Minimal BASIC Command Set?

When I was in college, a fellow student programmer proffered the opinion
that a certain couple of keywords were critical components of any programming
language. Prompted by a small wager, I created a designated algorithm
without using his "indispensable" syntax. Subsequently, I have wondered
just what **are** the minimal features with which one might construct a
BASIC algorithm.

As with every other application, each upgrade of your favorite compiler offers new and wonderful keywords and constructs for your enjoyment. Are they handy? You betcha. Are they really necessary? Mostly not. The essential tools for algorithm design have existed since the early days of programming; much of the rest is window dressing.

— My Proposal —

*If an algorithm can be written in BASIC, then it can
be written by utilizing just two of the following keywords
and functions:*

Math: LOG LOG2 LOG10 EXP EXP2 EXP10 SQR n^e MOD ABS SGN SWAP BIT BITS Bitwise-AND Bitwise-OR Trigonometry functions Logic: IF THEN ELSE ELSEIF ISTRUE ISFALSE IIF NOT AND OR IMP EQV XOR CHOOSE SWITCH EXTRACT MIN MAX Program flow: FOR NEXT WHILE WEND DO LOOP GOTO GOSUB ON SELECT CASE

That's right — I contend that all but two of those 50+ programming aids
are expendable, and that's only a partial listing. Furthermore, no external
assistance need be employed, such as using assembler commands or shelling to a
magic module that performs calculations. The resultant code might be somewhat
lengthy, but it can be ~~self-sufficient.~~

— The Challenge —

- Which are my two secret weapons?
- How might one utilize them to get the job done?
- What minimal command set would
**you**require?

Mind you, I am not a world-class programmer; so Kudos and my undying admiration go to anyone who can solve this puzzle. Alternatively, if you think I'm full of shit, perhaps a little wager can be arranged!

Actually, I believe that there might be two different solutions to the challenge. In any case, a real human would be happy just to talk about this stuff.