Finding the sum of all the multiples of 3 or 5 below 1000 As a Lisp (and functional programming) newbie, I wrote the following code that finds the sum of all the multiples of 3 or 5 below 1000, and I suspect that it is lousy:

(defun multiple-of-3-or-5 (x) 
    (or (eq (mod x 3) 0) (eq (mod x 5) 0)) )

(defun generate-list (min max) 
    (cond ((&gt; min max) nil) 
          (t (cons min (generate-list (+ min 1) max )))))

(defun my-sum (my-list) 
    (cond ((atom my-list) 0) 
          (t (+ (cond ((multiple-of-3-or-5 (car my-list)) (car my-list)) 
              (t 0)) 
            (my-sum (cdr my-list))))))


Any general advice is most welcome. Specifically, I have these questions (other than what you could say):


I had to extend the stack multiple times (using LispWorks) to get a result. Is my use of recursion wrong? 
Should I prefer iterative approach over recursion in Lisp too? (as in imperative languages)
Should I use the loop macro if I am to solve it in iterative fashion?
You are not using tail recursion in my-sum, so the compiler cannot easily turn it into iteration.
It depends on the specific problem; in this case I would probably do it iteratively.
Sure, loop is useful and convenient.


Here is my attempt:

(defun multiple-of-3-or-5 (x) 
    (or (zerop (mod x 3))
        (zerop (mod x 5))))
(defun my-sum (from to)
  (loop :for i :from from :to to
    :when (multiple-of-3-or-5 i) 
    :sum i))