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?
-
Show this thread
-
Replying to @TimSweeneyEpic
eh, jesus christ that one's messy. in scopes i would have to work with vectors of bits, and write a custom adder for this. particularly that `n` can be infinitely big makes this challenge quite awful.
1 reply 0 retweets 0 likes -
Replying to @paniq @TimSweeneyEpic
L. 😷. Ritter Retweeted Tim Sweeney
and your particular syntax hides the fact that there's an embedded inc by 1 that operates on a buffer of arbitrary size. and what magic is 'X' .. 'Y' supposed to do? what are we returning here? what is the type of those expressions?https://twitter.com/TimSweeneyEpic/status/1265457474510913537 …
L. 😷. Ritter added,
2 replies 0 retweets 0 likes -
Replying to @paniq
“for(a) do b” produces an array by iterating over each choice of a (possibly binding variables there) and adding the element b (possibly referencing variables in a, and possibly introducing new choice backtracking points upon each iteration).
2 replies 0 retweets 1 like
The ultimate work outlining this approach and all of its nuances is https://archive.org/details/ONTICAKnow_00_McAl …
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.