Mercurial > repos > rhope
view interp.rhope @ 181:a658c17148cb
Add == worker
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 27 Jul 2011 21:06:35 -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[]] }