开发者

Why isn't this Do Form valid?

开发者 https://www.devze.com 2023-03-10 22:39 出处:网络
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:

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&开发者_如何学Gogt;)

Where's the error in my understanding of this?


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消