((>= i 10))
(alert (+ "i is " i " and j is " j))))
-; compiles to
+;; compiles to
"
for (var i = 0, j = arr[i]; i < 10; i = ++i, j = arr[i]) {
alert('i is ' + i + ' and j is ' + j);
(create :foo "foo"
:bla "bla"))
-; compiles to
+;; compiles to
"
{ foo : 'foo',
bla : 'bla' }
"The link is: "
((:a :href href) link-text))))))
-; compiles to
+;; compiles to
"
function addDiv(name, href, linkText) {
document.write('<div id=\"' + name + '\">The link is: <a href=\"'
(div.bl0rg :font-family "serif")
(("a:active" "a:hoover") :color "black" :size "200%"))))))
-; which produces
+;; which produces
<html><head><style type="text/css">
<!--
(if (consp form)
(let ((op (car form))
(args (cdr form)))
- (cond ((equal op 'quote) (values (if (equalp '(nil) args) nil form) ;; leave quotes alone, unless it's a quoted nil
+ (cond ((equal op 'quote) (values (if (equalp '(nil) args) nil form) ; leave quotes alone, unless it's a quoted nil
nil))
((script-macro-p op) (values (ps-macroexpand (funcall (lookup-macro-expansion-function op) form)) t))
(t (values form nil))))
(defmacro defun-js (old-name new-name args &body body)
`(defun ,old-name ,args
- ,(when (and (stringp (car body)) (< 1 (length body))) ;; docstring
+ ,(when (and (stringp (car body)) (< 1 (length body))) ; docstring
(car body))
(warn-deprecated ',old-name ',new-name)
,@body))
-;;; DEPRECATED INTERFACE ;;;
+;;; DEPRECATED INTERFACE
(defun js-equal (ps-form1 ps-form2)
(warn-deprecated 'js-equal)
(in-package :parenscript)
-(defun process-html-forms (forms) ;; this needs a rewrite
+(defun process-html-forms (forms) ; this needs a rewrite
(let ((res ()))
(labels ((handle-form (form)
(cond ((keywordp form)
#:t
#:f
#:true
- #.(symbol-name 'nil) ;; for case-sensitive Lisps like some versions of Allegro
+ #.(symbol-name 'nil) ; for case-sensitive Lisps like some versions of Allegro
#:this
#:false
#:undefined
(let ((macros ())
(binds ()))
(dolist (spec collections)
- ; (unless (proper-list-of-length-p spec 1 3)
- ; (error "malformed collection specifier: ~S" spec))
+ ;;(unless (proper-list-of-length-p spec 1 3)
+ ;; (error "malformed collection specifier: ~S" spec))
(let* ((name (first spec))
(default (second spec))
(kind (or (third spec) 'collect))
;;; even if they could conceivably be legal in not-quite-a-lambda-list
;;; weirdosities
(defun parse-lambda-list (lambda-list)
-
;; Classify parameters without checking their validity individually.
(multiple-value-bind (required optional restp rest keyp keys allowp auxp aux
morep more-context more-count beyond-requireds? key-object)
(parse-lambda-list-like-thing lambda-list)
(declare (ignore beyond-requireds?))
-
;; Check validity of parameters.
(flet ((need-symbol (x why)
(unless (symbolp x)
(t
(format t "&KEY parameter is not a symbol or cons: ~S"
i))))))
-
;; Voila.
(values required optional restp rest keyp keys allowp auxp aux
morep more-context more-count key-object)))
(defmethod parenscript-print (ps-form &optional *ps-output-stream*)
(setf *indent-level* 0)
(flet ((print-ps (form)
- (if (and (listp form) (eql 'js-block (car form))) ;; ignore top-level block
+ (if (and (listp form) (eql 'js-block (car form))) ; ignore top-level block
(loop for (statement . remaining) on (third form) do
(ps-print statement) (psw ";") (when remaining (psw #\Newline)))
(ps-print form))))
(with-output-to-string (*ps-output-stream*)
(print-ps ps-form)))))
-(defun psw (obj) ;; parenscript-write
+(defun psw (obj) ; parenscript-write
(princ obj *ps-output-stream*))
(defgeneric ps-print% (special-form-name special-form-args))
(defgeneric ps-print (compiled-form))
-(defmethod ps-print ((form null)) ;; don't print top-level nils (ex: result of defining macros, etc.)
+(defmethod ps-print ((form null)) ; don't print top-level nils (ex: result of defining macros, etc.)
)
(defmethod ps-print ((compiled-form cons))
(declare (ignore x y))
(when specified? (cons var val))))
keys))))
- (body-paren-forms (parse-function-body body)) ;remove documentation
- ;;
+ (body-paren-forms (parse-function-body body)) ; remove documentation
(initform-forms
(mapcar #'(lambda (default-pair)
`(defaultf ,(car default-pair) ,(cdr default-pair)))
(coerce (nreverse res) 'string)))
(t (string-join (mapcar #'symbol-to-js symbols) "")))))
-(defun ordered-set-difference (list1 list2 &key (test #'eql)) ;; because the CL set-difference may not preserve order
+(defun ordered-set-difference (list1 list2 &key (test #'eql)) ; because the CL set-difference may not preserve order
(reduce (lambda (list el) (remove el list :test test))
- (cons list1 list2)))
\ No newline at end of file
+ (cons list1 list2)))