aboutsummaryrefslogtreecommitdiff
path: root/ps/step2_eval.ps
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-03-31 23:05:41 -0500
committerJoel Martin <github@martintribe.org>2014-03-31 23:05:41 -0500
commit3da90d39071ddd9a70c6adaf69fbc8f8b99346dd (patch)
treef6f0567ae30fbd54dda6d43e8336f56e35ed828f /ps/step2_eval.ps
parent8e7e339db8060f95d27694b93b8d4d648d13c083 (diff)
downloadmal-3da90d39071ddd9a70c6adaf69fbc8f8b99346dd.tar.gz
mal-3da90d39071ddd9a70c6adaf69fbc8f8b99346dd.zip
PS: add step8_macros.
Use dicts rather than array block for user defined mal function type. Add fload function to setup call from a mal_function dict.
Diffstat (limited to 'ps/step2_eval.ps')
-rw-r--r--ps/step2_eval.ps10
1 files changed, 4 insertions, 6 deletions
diff --git a/ps/step2_eval.ps b/ps/step2_eval.ps
index 04e6a50..aa34bf5 100644
--- a/ps/step2_eval.ps
+++ b/ps/step2_eval.ps
@@ -13,14 +13,14 @@
/env exch def
/ast exch def
%(eval_ast: ) print ast ==
- /nametype ast type eq { %if symbol
+ ast _symbol? { %if symbol
env ast known {
env ast get
}{
(') ast pr_str (' not found)
concatenate concatenate throw
} ifelse
- }{ /arraytype ast type eq { %elseif list
+ }{ ast _list? { %elseif list
[
ast {
env EVAL
@@ -35,13 +35,11 @@ end } def
/env exch def
/ast exch def
%(EVAL: ) print ast ==
- /arraytype ast type ne { %if not a list
+ ast _list? not { %if not a list
ast env eval_ast
}{ %else apply the list
/el ast env eval_ast def
- el _rest % args array
- el _first % function
- exec % apply function to args
+ el _rest el _first exec % apply function to args
} ifelse
end } def