Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

LISP: A dynamic car

Name: Anonymous 2012-01-30 20:27

I have a complex list of lists and want something to check the second element of every list of the list in the loop, any supported features like this?

Name: Anonymous 2012-02-19 14:56

>>51
Your parentheses are imbalanced, and based on your indentation, I don't think your ifs are doing what you want them to. First of all, null x needs to be inside parentheses. Also, in the first if expression, the inner if is part of the else block - it will be executed if x is non-null.

Here are some other suggestions. They're mostly style things, so they're not causing any problems, but they'll make your code look nicer.

(setq counter (+ counter 1)) -> (incf counter)
let* is unnecessary in this case - use let.
(if (null x) ...) -> (unless x ...) if there's no else
(equal (mod counter 2) 0) -> (evenp counter) - same for 1, oddp

As for the problem in the loop, close the parenthesis around and, and then you need the loop keyword do.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List