Mercurial > repos > rhope
view interp.rhope @ 189:d0e3a13c1bd9 default tip
Remove old calculator example
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 07 Oct 2011 00:24:04 -0700 |
parents | 0c7c5671fcd3 |
children |
line wrap: on
line source
Import interplookup.rhope _Get Line[string:out] { char <- Get Char[] If[[char]=["\n"]] { out <- string }{ out <- _Get Line[[string]Append[char]] } } Get Line[:out] { out <- _Get Line[""] } Do Set Input[worker,val,num:out] { out <- [worker]Set Input[num, val] } Interp Loop[lookup:out] { [Get Line[]]Split[" "] { fname <- [~]Index[0] args <- Map[Tail[~, 1], Int32[?]] } [lookup]Index[fname] { worker <- Fold[Do Set Input[?], ~, args] } { continue <- Print[["Could not find "]Append[fname]] } continue <- Print[worker[]] Val[continue] { out <- Interp Loop[lookup] } } Main[:out] { out <- Interp Loop[Func Lookup[]] }