diff options
Diffstat (limited to 'matlab/step2_eval.m')
| -rw-r--r-- | matlab/step2_eval.m | 10 |
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) |
