Examples
Coming soon!
Debugging
Debugging a lazy functional program can be tricky. show
can be used to pretty print values before the rest of the output.
Getting folds/iterates correct can also be tricky due to their circular/infinite nature. I recommend first writing the code that maps desired input to desired output for the function of the fold, and then calling it manually with all examples at once (so that you are using it vectorized like the real function will be).
For example, for the fibonacci program. Let's we could say our inputs are 1 1 2 3
we can just test those rather than the infinite list:
1,1,2,3 set inputs inputs 0 cons + → [1,2,3,5]
↗️
And that is our desired output since 1 iterate
will prepend the 1
for us.