Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update chapter-11.lisp #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/chapter-11.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,20 @@

;; p. 156

;; problem reported to pg but not checked -- test this!!!!!!!!!!
;; The problem reported to pg listed at
;; http://www.paulgraham.com/onlisperrata.html:
;; p. 156. In do-tuples/o the expression (1- (length parms)) should be
;; "p. 156. In do-tuples/o the expression (1- (length parms)) should be
;; (- (length source) (length parms)).
;; Reported by Roland. (at netquant.com.br)
;; Reported by Roland. (at netquant.com.br)"
;; is wrong, the original text below has the correct code.
(defmacro do-tuples/o (parms source &body body)
(if parms
(let ((src (gensym)))
`(prog ((,src ,source))
(mapc (lambda ,parms ,@body)
,@(map0-n (lambda (n)
`(nthcdr ,n ,src))
;;(1- (length parms)) ;; error in text
(- (length source) (length parms)) ;; corrected

))))))
(1- (length parms))))))))

(defmacro do-tuples/c (parms source &body body)
(if parms
Expand Down