Skip to content

Commit

Permalink
corrected a typo, and changed the implementation of extract declarati…
Browse files Browse the repository at this point in the history
…ons from using cl:do to using cl:loop
  • Loading branch information
alaa-alawi committed May 1, 2012
1 parent 3a031d7 commit 835fabd
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions util.lisp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -229,12 +229,14 @@ character set."
(escape-string string :test #'non-7bit-ascii-escape-char-p)) (escape-string string :test #'non-7bit-ascii-escape-char-p))


(defun extract-declarations (body) (defun extract-declarations (body)
"Given a FORM, the declarations - if any - will be exctracted "Given a FORM, the declarations - if any - will be extracted
from the head of the FORM, and will return two values the declarations, from the head of the FORM, and will return two values the declarations,
and the remaining of FORM" and the remaining of FORM"
(do ((sexp (first body) (first forms)) (loop for sexp = (first body) then (first forms)
(forms (rest body) (rest forms)) for forms = (rest body) then (rest forms)
(declarations nil)) for declarations = nil
((not (eq (first sexp) 'cl:declare)) if (not (eq (first sexp) 'cl:declare))
(values declarations (append (if (null sexp) sexp (list sexp)) forms))) do (return (values declarations
(push sexp declarations))) (append (if (null sexp) sexp (list sexp)) forms)))
else
do (push sexp declarations)))

0 comments on commit 835fabd

Please sign in to comment.