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?
-
-
Is this a quirky, special-case language feature? Definitely not; it has well-defined semantics and increases the expressive power of loops. And it's what 14-year-old me intuitively tried to do in Apple BASIC.
Show this thread -
There are many interesting solutions in this thread. The C and JavaScript solutions seen akin to mechanical devices that crank out solutions. One is an astonishingly short Haskell composition of library functions:https://twitter.com/tikhonjelvis/status/1265453175219183616?s=20 …
Show this thread -
There is generally a barrier to reading these solutions. In one case you have to run through the behavior of imperative code in your head to understand what it does. In another you have to understand the near magical incantation of pointfree function compositions.
Show this thread -
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 thread
End of conversation
New conversation -
-
-
pretty sure i hate this because it pretends to be imperative even though it is entirely functional.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
if y’all flood the map i’m unsinstalling
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
You know what would be awesome? Greater variability in custom game options including disallowing admitence for banned accounts from the host supplier, loot multiplier, etc.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
In any other language, this code would print out "XY" n times. How could you get this back in your language?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
this is some next level big brain stuff.
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.