[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BUG -- NOT
- To: email@example.com
- Subject: BUG -- NOT
- From: firstname.lastname@example.org (Bob Hall)
- Date: Fri, 18 Sep 92 11:02:08 EDT
- Cc: email@example.com
- In-reply-to: Mike Zuniga's message of Fri, 18 Sep 92 10:17:09 EDT <9209181417.AA03481@krieger.itd.nrl.navy.mil>
HI! The following code sements are not identical, though according
to GSteel's Lisp book (2nd ed) they should be:
(sort lis 'test1)
(sort lis 'test2)
(setq lis (sort lis 'test1))
(setq lis (sort lis 'test2))
I belive the top version leads to error: some parts of lis are left out.
Of course they are different. SORT is defined to be
destructive [CLtL2, p.408], so you have to catch the output and setq lis.
Also, the following code segments are not identical:
(print '(lambda (x) (car x)) lis)
(print 'car lis)
The lisp interpreter/compiler does not like the first one. I think if I put
#' intead of ' it will accept it, but it should not be so. I thought the
# symbol in this case was to allow for functions/values declared outside of the
lambda body and used withing the lambda body.
??? PRINT's second arg should be a stream, not a list. Thus, both of the
above code fragments should error. Maybe you meant
(print ((lambda (x) (car x)) lis)), which does behave equivalently to
(print (car lis))
except that MCL might complain if lis is not declared free;
MCL by default compiles even s-exps you type at the interpreter.
If you do (defvar lis '(a b c)) first, the two above behave the same.
- From: firstname.lastname@example.org (Mike Zuniga)