Another Currying Example in Marvin
2005-04-12Please see my previous post before if you haven't done so.
I've quoted David Mertz's article Charming Python in my previous post. In that article, (besides other things) a Haskell function is curryied as:
computation a b c d = (a + b^2+ c^3 + d^4)
Then it is filled as follows:
fillOne = computation 1
fillTwo = fillOne 2
fillThree = fillTwo 3
answer = fillThree 5
and the answer is 657. The same thing can be done in Marvin:
[ swap 2 ** + swap 3 ** + swap 4 ** + ] :computation
[ 1 \computation ] :fillOne
[ 2 \fillOne ] :fillTwo
[ 3 \fillTwo ] :fillThree
5 \fillThree