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 more a solution can resemble a simple recitation of the problem to be solved, and rely on the compiler to generate the code, the better for ease of reading and writing code.
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
not sure if you are referring to this one in particular, but I don't believe there is much about this that is "point-free" -- aside from one arguable case (using `print` instead of `(\n -> print n)`). Point free is always a stylistic choice and never actually a requirement :)
-
I do agree that point-free code can be very unreadable, but you can usually get the same expressiveness with fully pointful code -- and
@tikhonjelvis 's solution is a shining example
- 5 more replies
New conversation -
-
-
Recursion is magic
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Hey Tim how are you?
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.