+(define-compilation equal (x y)
+ (concat "(" (ls-compile x env fenv) " == " (ls-compile y env fenv) ")"))
+
+(define-compilation string (x)
+ (concat "String.fromCharCode(" (ls-compile x env fenv) ")"))
+
+(define-compilation stringp (x)
+ (concat "(typeof(" (ls-compile x env fenv) ") == \"string\")"))
+
+(define-compilation string-upcase (x)
+ (concat "(" (ls-compile x env fenv) ").toUpperCase()"))
+
+(define-compilation string-length (x)
+ (concat "(" (ls-compile x env fenv) ").length"))
+
+(define-compilation char (string index)
+ (concat "("
+ (ls-compile string env fenv)
+ ").charCodeAt("
+ (ls-compile index env fenv)
+ ")"))
+
+(define-compilation concat-two (string1 string2)
+ (concat "("
+ (ls-compile string1 env fenv)
+ ").concat("
+ (ls-compile string2 env fenv)
+ ")"))
+
+(define-compilation funcall (func &rest args)
+ (concat "("
+ (ls-compile func env fenv)
+ ")("
+ (join (mapcar (lambda (x)
+ (ls-compile x env fenv))
+ args)
+ ", ")
+ ")"))
+
+(define-compilation apply (func &rest args)
+ (if (null args)
+ (concat "(" (ls-compile func env fenv) ")()")
+ (let ((args (butlast args))
+ (last (car (last args))))
+ (concat "function(){" *newline*
+ "var f = " (ls-compile func env fenv) ";" *newline*
+ "var args = [" (join (mapcar (lambda (x)
+ (ls-compile x env fenv))
+ args)
+ ", ")
+ "];" *newline*
+ "var tail = (" (ls-compile last env fenv) ");" *newline*
+ "while (tail != false){" *newline*
+ " args.push(tail[0]);" *newline*
+ " args = args.slice(1);" *newline*
+ "}" *newline*
+ "return f.apply(this, args);" *newline*
+ "}" *newline*))))
+
+(define-compilation js-eval (string)
+ (concat "eval(" (ls-compile string env fenv) ")"))
+
+
+(define-compilation error (string)
+ (concat "(function (){ throw " (ls-compile string env fenv) ";" "return 0;})()"))
+
+(define-compilation new ()
+ "{}")
+
+(define-compilation get (object key)
+ (concat "(" (ls-compile object env fenv) ")[" (ls-compile key env fenv) "]"))
+
+(define-compilation set (object key value)
+ (concat "(("
+ (ls-compile object env fenv)
+ ")["
+ (ls-compile key env fenv) "]"
+ " = " (ls-compile value env fenv) ")"))
+
+(defun macrop (x)
+ (and (symbolp x) (eq (binding-type (lookup-function x *fenv*)) 'macro)))