I love this idea. It is very unique and very creative.
However, I’m having difficulty following the two example programs, even though an explanation for each is given. It would be nice to have some simpler examples first. It is claimed that the “Prelude hats” can be implemented in terms of the primitive ones. It would be nice if an implementation for most if not all of them were given. This would provide an easy-to-follow introduction into the principles of programming in this language. — Timwi 00:03, 27 May 2011 (UTC)
- Thanks for the feedback! Implementing the Prelude in pure Hatter is in my plans. (The name "prelude" is taken from Haskell, by the way.) To understand the examples, you might try to decompose the streams of movements of each magic into its constituent parts. For exemple, the magic of the 'fib' hat:
can be decomposed into:
@->@1 (put the bottommost argument (let's call it a) in @1) @->horn (copy the second argument (let's call it b) to horn) horn->add (copy b to add) horn->@ (copy b back to the stack) horn<-@1 (move a to horn) horn->@ (copy a back to the stack (now the stack is just as it was in the beginning)) horn->add (copy a to add (now add has accumulated a and b)) add->@ (copy the result to the stack (now the stack has a+b, a, b, and the calling hat can take the first element of the sequence (b); when the next element is taken, the process is repeated, each time generating a new element of the sequence.))
– Huangho 16:49, 28 May 2011 (UTC)