Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, and the inventor of the language eventually removed ELSE from his dialects, amusingly. These days he says that his code has very few conditional statements.

I think the tactic strategy to achieve this is to confine conditional branches in a few well chosen words.

For instance if you have a word SORT that sorts the top pair on the stack, which has to have a branch:

    : SORT 2DUP < IF SWAP THEN ;
then you can build "if-less" MIN, MAX and ABS:

    : MIN SORT NIP ;

    : MAX SORT DROP ;

    : ABS 0 SORT SWAP - ;


Despite my somewhat crippled ability to think RPN, I love the simplicity and expressiveness of the above.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: