From ... From: Erik Naggum Subject: Re: distinction? Date: 2000/12/04 Message-ID: <3184959294361655@naggum.net>#1/1 X-Deja-AN: 701143328 References: <3a2962c9@news.infinetgroup.com> <90gtse$gg0$1@news.gte.com> mail-copies-to: never Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsmaster@eunet.no X-Trace: oslo-nntp.eunet.no 975971821 25060 195.0.192.66 (4 Dec 2000 23:17:01 GMT) Organization: Naggum Software; vox: +47 800 35477; gsm: +47 93 256 360; fax: +47 93 270 868; http://naggum.no; http://naggum.net User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7 Mime-Version: 1.0 NNTP-Posting-Date: 4 Dec 2000 23:17:01 GMT Newsgroups: comp.lang.lisp * Dorai Sitaram | There is a quite antient technique that allows one to | build up a list left-to-right in one pass, at the | constant overhead of just a couple of extra conses. Only one extra cons, actually. (do* ((tail (cons nil nil) (cdr tail)) (head (cdr tail)) (list (cdr list)) element) ((null list) head) (setf element (car list)) ... (setf (cdr tail) (list element))) | Nobody seems to use it though and it isn't even mentioned in textbooks | anymore. Well, it has naturally become macrofied because it _is_ quite hairy and intrusive to write manually every time. Software patterns notwithstanding, some things are just better off being macros. | I think I saw it in an old book by Wilensky or Touretzky? I have only seen it explained. The coding seems to vary according to the specific needs of the body of the loop. #:Erik -- "When you are having a bad day and it seems like everybody is trying to piss you off, remember that it takes 42 muscles to produce a frown, but only 4 muscles to work the trigger of a good sniper rifle." -- Unknown