Subject: Re: newbie: can this be done better (and how)?
From: Erik Naggum <>
Date: Mon, 11 Feb 2002 20:45:45 GMT
Newsgroups: comp.lang.lisp
Message-ID: <>

* 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 <list> 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)

  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.