Here's a neat test of programming language expressiveness: Can you write a function PrintXY taking an integer n>=0 that prints all strings of length n containing only the characters 'X' and 'Y'? Can you do it without recursion, and without assuming n<=64? Is it readable?
-
-
The power of this comes from backtracking being delimited to the domain of the ‘for’. The expression a backtracks and produces new choices in that domain, while the range b contributes its choices to the surrounding context.
-
This particular programming challenge is just a funny example. You could also write if(as[i:int]==3) then... else ..., which binds i to the first element of the array as that equals 3, or takes the else-branch if none. Functional logic gives you finite search everywhere.
- 6 more replies
New conversation -
-
-
The ultimate work outlining this approach and all of its nuances is https://archive.org/details/ONTICAKnow_00_McAl …
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.