From ... Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!195.64.68.27!newsgate.cistron.nl!amsnews01.chello.com!news01.chello.no!not-for-mail Newsgroups: comp.lang.lisp Subject: Re: newbie: can this be done better (and how)? References: <3C67A47E.4060607@fsb.hr> Mail-Copies-To: never From: Erik Naggum Message-ID: <3222449147162030@naggum.net> Organization: Naggum Software, Oslo, Norway Lines: 22 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 11 Feb 2002 20:45:45 GMT X-Complaints-To: abuse@chello.no X-Trace: news01.chello.no 1013460345 212.186.234.171 (Mon, 11 Feb 2002 21:45:45 MET) NNTP-Posting-Date: Mon, 11 Feb 2002 21:45:45 MET X-Received-Date: Mon, 11 Feb 2002 21:45:57 MET (news01.chello.no) Xref: archiver1.google.com comp.lang.lisp:26272 * Josip Krapac | What is better (faster) to use in this case: iteration or recursion? Since you ask in a Common Lisp question, here is a non-Scheme answer: (loop for pos upfrom 0 for elt in collect (+ pos elt)) You can call a variable "list" in Common Lisp, although Scheme forces you to use stupid, unreadable things like "lst" because it used up "list". In general, you should pretend you never learned, never even saw Scheme if you want to succeed in learning Common Lisp. What you have learned of Scheme is actually harmful to your ability to learn Common Lisp. For instance, (setf pos (+ pos 1)) is written (incf pos) in Common Lisp. (setf new-list (cons (+ obj pos) new-list)) is written (push (+ obj pos) new-list). /// -- In a fight against something, the fight has value, victory has none. In a fight for something, the fight is a loss, victory merely relief.