diff options
| author | Chouser <chouser@n01se.net> | 2015-02-15 14:10:47 -0500 |
|---|---|---|
| committer | Chouser <chouser@n01se.net> | 2015-02-21 13:22:44 -0500 |
| commit | 136ce7c9afb5e103133fe6e423e6dad3d23db38d (patch) | |
| tree | c317f90935a7ef0e65abd41122adfaa7576bb831 /forth/step3_env.fs | |
| parent | 60801ed68d5b2c6630c83883de150ccce98767f9 (diff) | |
| download | mal-136ce7c9afb5e103133fe6e423e6dad3d23db38d.tar.gz mal-136ce7c9afb5e103133fe6e423e6dad3d23db38d.zip | |
forth: Split types for user fns vs native fns
Diffstat (limited to 'forth/step3_env.fs')
| -rw-r--r-- | forth/step3_env.fs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/forth/step3_env.fs b/forth/step3_env.fs index c15f52b..7dc9d7e 100644 --- a/forth/step3_env.fs +++ b/forth/step3_env.fs @@ -8,10 +8,10 @@ require env.fs loop ; 0 MalEnv. constant repl-env -s" +" MalSymbol. :noname args-as-native + MalInt. ; MalFn. repl-env env/set -s" -" MalSymbol. :noname args-as-native - MalInt. ; MalFn. repl-env env/set -s" *" MalSymbol. :noname args-as-native * MalInt. ; MalFn. repl-env env/set -s" /" MalSymbol. :noname args-as-native / MalInt. ; MalFn. repl-env env/set +s" +" MalSymbol. :noname args-as-native + MalInt. ; MalNativeFn. repl-env env/set +s" -" MalSymbol. :noname args-as-native - MalInt. ; MalNativeFn. repl-env env/set +s" *" MalSymbol. :noname args-as-native * MalInt. ; MalNativeFn. repl-env env/set +s" /" MalSymbol. :noname args-as-native / MalInt. ; MalNativeFn. repl-env env/set \ Fully evalutate any Mal object: def-protocol-method mal-eval ( env ast -- val ) @@ -34,7 +34,7 @@ MalKeyword endif ;; drop -MalFn +MalNativeFn extend invoke { env list this -- list } \ Pass args on dictionary stack (!) \ TODO: consider allocate and free of a real MalList instead @@ -44,8 +44,8 @@ MalFn list MalList/count @ 1 ?do env expr-start i cells + @ mal-eval , loop - val-start here val-start - cell / this ( argv argc MalFn ) - MalFn/xt @ execute + val-start here val-start - cell / this ( argv argc MalNativeFn ) + MalNativeFn/xt @ execute val-start here - allot ;; drop |
