Mike
Mike

Reputation: 19717

Why isn't this Do Form valid?

I'm new to Common Lisp. I tried out the following do form:

(do ((n 0 (+ n 1)))
    (< n 10)
    (print n))

Clisp responds with:

*** - IF: variable < has no value

From my understanding, the do form is as follows:

(do (<lexically scoped variables> [per-iteration-expression])
    (end-expression)
    <statements>)

Where's the error in my understanding of this?

Upvotes: 1

Views: 107

Answers (2)

cwallenpoole
cwallenpoole

Reputation: 82028

Forgive me, my Lisp is rusty, but shouldn't that be a >? And then shouldn't it be ((> n 10))? (Two parens, not one. You need something evaluated there).

This could be completely wrong, but that would be my next try.

Upvotes: 3

trutheality
trutheality

Reputation: 23465

According to this (random Google search result), the second term should be ((end-expression) return-value).

Upvotes: 1

Related Questions