Mercurial > repos > rhope
diff functional.rhope @ 75:0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 06 Jul 2010 07:52:59 -0400 |
parents | |
children | 004f0fc8941f |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/functional.rhope Tue Jul 06 07:52:59 2010 -0400 @@ -0,0 +1,30 @@ + +_Fold[list,index,current,worker:out] +{ + Print["_Fold"] + { Print[index] + { + newval <- [worker]Call[current, [list]Index[index], index] + + [list]Next[index] + { + out <- _Fold[list, ~, newval, worker] + }{ + out <- Val[newval] + } + }} +} + +Fold[worker,start,list:out] +{ + Print["Fold"] + [list]First + { + Print["Got first"] + out <- _Fold[list, ~, start, worker] + }{ + Print["no first"] + out <- start + } +} +