home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.lisp
- Path: sparky!uunet!spool.mu.edu!torn!nott!bnrgate!bcars267!news
- From: emcoop@bnr.ca (hume smith)
- Subject: Re: Re: Lucid Lisp complains about this code fragment
- Message-ID: <21495.1993Jan5.094839@bcars148>
- Sender: news@bnr.ca (usenet)
- Nntp-Posting-Host: bcars148
- Organization: Bell-Northern Research, Ottawa, Canada
- X-Poster: Emacs-NNTP-0.1
- References: <1ibjv0INN2pk@early-bird.think.com> <1iat18INNii@MINERVA.CIS.YALE.EDU>
- Date: Tue, 5 Jan 1993 14:48:39 GMT
- Lines: 24
-
- In <1ibjv0INN2pk@early-bird.think.com>, barmar@think.com (Barry Margolin) said:
- > In Common
- > Lisp, if you don't want TWEAK to be in the global namespace, you should
- > write:
- >
- > (defun add-noise-to-list-of-numbers (l)
- > (flet ((tweak (x)
- > (+ x
- > (- (* (random 1000) .0001) .05))))
- > (mapcar #'tweak l)))
-
- you could also say
-
- (defun add-noise-to-list-of-numbers (l)
- (mapcar #'(lambda (x) (+ x (* (random 1000) .0001) -.05)) l))
-
- but that may be less efficient - for instance, in XLisp, each time
- add-noise-to-list-of-numbers is called a new closure is made. i think.
- --
- Hume Smith Wenn ich des Tages nicht dreimal
- hume.smith@acadiau.ca mein Schaelchen Coffee trinken darf,
- emcoop@bnr.ca so werd' ich ju zu meiner Qual
- wie ein verdorrtes Ziegenbraetchen.
-
-