aboutsummaryrefslogtreecommitdiff
path: root/matlab/step2_eval.m
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2015-02-07 22:07:16 -0600
committerJoel Martin <github@martintribe.org>2015-02-07 22:07:16 -0600
commitab6e6fae4e8935fca5fb33bd8645fe9cece18bb9 (patch)
treea16b76c8ae011b8363dffd3e01e5d927f89d2467 /matlab/step2_eval.m
parenta8d58c9360834ce70472f5719227f76fcf8c52d7 (diff)
downloadmal-ab6e6fae4e8935fca5fb33bd8645fe9cece18bb9.tar.gz
mal-ab6e6fae4e8935fca5fb33bd8645fe9cece18bb9.zip
matlab: step3
Diffstat (limited to 'matlab/step2_eval.m')
-rw-r--r--matlab/step2_eval.m10
1 files changed, 6 insertions, 4 deletions
diff --git a/matlab/step2_eval.m b/matlab/step2_eval.m
index 418bb84..4ce13fb 100644
--- a/matlab/step2_eval.m
+++ b/matlab/step2_eval.m
@@ -1,4 +1,4 @@
-function step1_read_print(varargin), main(varargin), end
+function step2_eval(varargin), main(varargin), end
% read
function ret = READ(str)
@@ -44,9 +44,11 @@ function ret = rep(str, env)
end
function main(args)
- repl_env = containers.Map( ...
- {'+', '-', '*', '/'}, ...
- {@(a,b) a+b, @(a,b) a-b, @(a,b) a*b, @(a,b) floor(a/b)});
+ repl_env = containers.Map();
+ repl_env('+') = @(a,b) a+b;
+ repl_env('-') = @(a,b) a-b;
+ repl_env('*') = @(a,b) a*b;
+ repl_env('/') = @(a,b) floor(a/b);
%cleanObj = onCleanup(@() disp('*** here1 ***'));
while (true)