changeset 238:3bfc00e4f5e5

Eval lambda assignments at macro expandion time so they can be called by macros
author Mike Pavone <pavone@retrodev.com>
date Sun, 05 Jan 2014 19:27:41 -0800
parents dae093baf36c
children 6aab8a5a2be9
files interp.js
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/interp.js	Sun Jan 05 17:00:33 2014 -0800
+++ b/interp.js	Sun Jan 05 19:27:41 2014 -0800
@@ -740,6 +740,9 @@
 			} else {
 				env.syms[expr.symbol.cleanName()] = {};
 				this.expressions[i] = expr.macroexpand(env);
+				if (this.expressions[i].expression instanceof lambda) {
+					env.syms[expr.symbol.cleanName()] = this.expressions[i].expression.eval(env);
+				}
 			}
 		} else {
 			this.expressions[i] = expr.macroexpand(env);