Remove ad-hoc binding writer functions
[jscl.git] / prelude.js
index 8321608..38a13d7 100644 (file)
@@ -1,15 +1,25 @@
+// This file is prepended to the result of compile ecmalisp.lisp, and
+// contain runtime code that ecmalisp assumes to exist.
+
+var window = this;
 var nil;
 
+function globalEval (x) {
+    return eval.call (window, x);
+}
+
 function pv (x) { return x==undefined? nil: x; }
 
 function mv(){
-    var r = [];
+    var r = [].slice.call(arguments);
     r['multiple-value'] = true;
-    for (var i=0; i<arguments.length; i++)
-        r.push(arguments[i]);
     return r;
 }
 
+function forcemv (x) {
+    return typeof x == 'object' && 'multiple-value' in x? x: mv(x);
+}
+
 // NOTE: Define VALUES to be MV for toplevel forms. It is because
 // `eval' compiles the forms and execute the Javascript code at
 // toplevel with `js-eval', so it is necessary to return multiple