From: Sam Steingold <sds@gn...> - 2010-10-18 21:24:50
I think this might be of interest to other clisp users,
so please reply to clisp-list
On Mon, Oct 18, 2010 at 2:18 AM, Kaz Kylheku <kaz@...> wrote:
> P.S. I found some issues too! CLISP's loop had let me get away with this
> loop for <subclause> and for <subclause>
> This is not apparently allowed by the standard grammar. What is joined by
> and are subclauses which do not begin with the for or as keyword!
;; According to the BNF syntax, "and" must not be followed by "for". But
;; ANSI CL section 18.104.22.168.1 contains ambiguous wording, and this example
;; appears in CLtL2 p. 743, we keep it.
(loop for numlist in '((1 2 4.0) (5 6 8.3) (8 9 10.4))
for a integer = (first numlist)
and for b integer = (second numlist)
and for c float = (third numlist)
collect (list c b a))
#-(or CMU SBCL) ((4.0 2 1) (8.3 6 5) (10.4 9 8))
#+(or CMU SBCL) ERROR
> Secondly, in CLISP I had relied on being able to do (loop for x [other
> clauses]) which will cause X to count from 0. In the CLHS grammar, it's
> clear that this abbreviation is not supported; you need that "from 0". Take
> a look at 22.214.171.124.1: ``At least one of the prepositions must be used''. The
> starting value does default to 0, of course.
indeed, clisp appears to accept (loop for x do (print x))
Sam Steingold <http://sds.podval.org>
Get latest updates about Open Source Projects, Conferences and News.