Alternative to do*?
Posted: Mon Jan 10, 2011 5:53 am
I'm basically writing a loop which i want to execute one-after-the-other rather than in parallel which is what 'do' does (if i'm understanding correctly!), I tried using do* but LispWorks threw an error at me - "Error: Unknown LOOP keyword in (...". So i'm a little confused..
Here is my code:
Any help would be much appreciated!

Here is my code:
Code: Select all
(defun simplify (expanded-list simplified-list)
(setq compared-value (car expanded-list))
(loop for term in (cdr expanded-list) do
(cond
((null term)
(progn (print "null") (return compared-value)))
((and (atom compared-value) (atom term))
(progn
(print "both numbers..")
(print compared-value)
(print term)
(print (+ compared-value term))
(print simplified-list)
(print (cddr expanded-list))
(return (list "newlist"
(list (+ compared-value term) simplified-list (cddr expanded-list))))
(print newlist)))
((and (listp compared-value) (listp term))
(if (equalp (cdr compared-value) (cdr term))
(list "newlist" (list
(cons
(+ (car compared-value) (car term))
(cdr term))
simplified-list
(cddr expanded-list)))))
(t (list "newlist"
(list (cons compared-value simplified-list (cddr expanded-list)))))))
(print "newlist:")
(print newlist)
(if (null (cddr expanded-list))
newlist
(simplify (cdr expanded-list) newlist)))