@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
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.
-
-
BTW This stuff is closely connected to a side project I have at work. You can write code Python like this: for i in range(10): x[i] = yield Bernoulli(0.5) and it'll build, and make inferences, using the full probability distribution, walking through all 2^10 states.
-
It's a loop over loops again. This one's very similar to the Haskell probability monads. (Also, note the trick of using Python coroutines to provide interesting semantics, similar to effect handling.)
- 1 more reply
New conversation -
-
-
(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.)
-
* monad autocorrect LOL
End of conversation
New conversation -
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.