- What's the least number of words needed to write it?
- What's the most efficient implementation?
For example, take a look at Implementing
MINin Forth without Conditional Code. The smallest version of
MINis 2 words shorter than eForth's
Even words with a trivial implementation can pose an interesting problem. For example which of the following is most efficient:
Jones Forth TUCK
: TUCK DUP -ROT ;
: TUCK SWAP OVER ;
OVERare all primitive, the alternative implementation will execute two fewer instructions on an 80x86 Forth. However,
-ROTis often implemented in Forth which would cause the Jones Forth
TUCKto be substantially slower. Here's a typical implementation of
: -ROT SWAP >R SWAP R> ;
If you can think of an alternative two word implementation of
TUCKor four word implementation of
-ROT, please let me know. :-)