@bbcmicrobot 10@%=0
15DEPTH=6
20DIMI(DEPTH)
30K=0
40FORI(K)=0TO1
50K=K+1
60IFK<=DEPTH G.40
70FORL=0TODEPTH
80PRINTI(L);
90N.
100P.
110K=K-1
120N.
130K=K-1
140G.120
-
-
-
Replying to @bbcmicrobot
This demonstrates an unusual BBC Micro programming technique. It allows you to nest a bunch for FOR loops as deep as you like controlled by DEPTH (as far as stack allows). This is an example of something you can do with an interpreter but not a compiler.
3 replies 3 retweets 23 likes -
Replying to @sigfpe @bbcmicrobot
This made my day, thanks (part of me wants to quibble that you could in fact do something damn near it with a compiler for a proper functional language like Scheme, but that part is a killjoy and needs to relax)
1 reply 0 retweets 2 likes -
Oh wow awesome! So that interpreter maintains an internal dynamic stack of for loops, closer to a functional logic language’s nested backtrack forks than to a traditional compiler’s static loop branching.
1 reply 2 retweets 5 likes -
I hadn't thought of it that way. A NEXT behaves a bit like Prolog's "fail".
2 replies 0 retweets 2 likes -
Functional logic can be so much simpler than Prolog! Just augment a functional language with failure (instead of Boolean False producing functions), unification (it’s the same as equality comparison), choice, if/for to cut and collect delimited choices.
2 replies 0 retweets 0 likes -
Replying to @TimSweeneyEpic @sigfpe and
(You can do this inside a nomad using Haskell comprehension syntax, but it’s a lot simpler if it’s a first class feature that commutes with all of the other features.)
1 reply 0 retweets 0 likes
* monad autocorrect LOL
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.