(defun consp (x) (consp x))
(defun car (x) (car x))
+(defun cdr (x) (cdr x))
+
(defun caar (x) (car (car x)))
(defun cadr (x) (car (cdr x)))
+(defun cdar (x) (cdr (car x)))
+(defun cddr (x) (cdr (cdr x)))
+
(defun caddr (x) (car (cdr (cdr x))))
+(defun cdddr (x) (cdr (cdr (cdr x))))
+
(defun cadddr (x) (car (cdr (cdr (cdr x)))))
-(defun cdr (x) (cdr x))
-(defun cdar (x) (cdr (car x)))
-(defun cddr (x) (cdr (cdr (cdr x))))
-(defun cdddr (x) (cdr (cdr (cdr (cdr x)))))
(defun first (x) (car x))
(defun second (x) (cadr x))
(skip-whitespaces-and-comments stream)
(let ((ch (%peek-char stream)))
(cond
+ ((null ch)
+ (error "Unspected EOF"))
((char= ch #\))
(%read-char stream)
nil)
((char= ch #\.)
(%read-char stream)
- (skip-whitespaces-and-comments stream)
(prog1 (ls-read stream)
+ (skip-whitespaces-and-comments stream)
(unless (char= (%read-char stream) #\))
(error "')' was expected."))))
(t
(let ((string "")
(ch nil))
(setq ch (%read-char stream))
- (while (not (char= ch #\"))
- (when (char= ch #\\)
+ (while (not (eql ch #\"))
+ (when (null ch)
+ (error "Unexpected EOF"))
+ (when (eql ch #\\)
(setq ch (%read-char stream)))
(setq string (concat string (string ch)))
(setq ch (%read-char stream)))
"})()" *newline*))))
(define-compilation js-eval (string)
- (concat "eval(" (ls-compile string env fenv) ")"))
+ (concat "eval.apply(window, [" (ls-compile string env fenv) "])"))
(define-compilation error (string)