From: Holly
Subject: until loop - getting "variable UNTIL is unbound"?
Date: 
Message-ID: <f68f8ce3.0302281439.2400e41a@posting.google.com>
I'm using GCL (Gnu Common Lisp) and I can't seem to get my while or
until loops to work?
Here is a very simple example of what happens!
Can anyone tell why it doesn't recognize UNTIL as a loop type?
Any help or info is appreciated :)


>(setq v1 1)
1
>(setq v3 3)
3
>(loop until (equal v1 v3) do (+ v1 1))

Error: The variable UNTIL is unbound.
Fast links are on: do (si::use-fast-links nil) for debugging
Error signalled by LOOP.
Broken at LOOP.  Type :H for Help.

From: Barry Margolin
Subject: Re: until loop - getting "variable UNTIL is unbound"?
Date: 
Message-ID: <KIR7a.34$271.249@paloalto-snr1.gtei.net>
In article <····························@posting.google.com>,
Holly <··········@holly-cam.com> wrote:
>I'm using GCL (Gnu Common Lisp) and I can't seem to get my while or
>until loops to work?
>Here is a very simple example of what happens!
>Can anyone tell why it doesn't recognize UNTIL as a loop type?
>Any help or info is appreciated :)

GCL only implements CLTL1, not ANSI CL.  So it only has the simple form of
LOOP without keywords.

-- 
Barry Margolin, ··············@level3.com
Genuity Managed Services, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Paul F. Dietz
Subject: Re: until loop - getting "variable UNTIL is unbound"?
Date: 
Message-ID: <avCdnaiFocXugv2jXTWcqA@dls.net>
Barry Margolin wrote:

> GCL only implements CLTL1, not ANSI CL.  So it only has the simple form of
> LOOP without keywords.

If you compile it with --enable-ansi, it has most of LOOP
(currently failing ansi-tests LOOP.6.19, LOOP.6.20, LOOP.6.37, LOOP.6.38,
LOOP.7.15, LOOP.7.16, LOOP.7.17, LOOP.7.18, LOOP.7.19, LOOP.7.20,
LOOP.7.21, LOOP.7.22, LOOP.7.23, LOOP.8.19, LOOP.8.20, LOOP.8.21,
LOOP.8.22, LOOP.8.ERROR.2, LOOP.9.10, LOOP.9.11, LOOP.9.27,
LOOP.9.28, LOOP.9.37, LOOP.9.38, LOOP.10.9, LOOP.10.10, LOOP.10.37,
LOOP.10.38, LOOP.10.57, LOOP.10.58, LOOP.10.85, LOOP.10.86,
LOOP.11.9 and LOOP.14.29).

	Paul
From: Matthew Danish
Subject: Re: until loop - getting "variable UNTIL is unbound"?
Date: 
Message-ID: <20030301014326.A32217@lain.cheme.cmu.edu>
On Fri, Feb 28, 2003 at 02:39:02PM -0800, Holly wrote:
> I'm using GCL (Gnu Common Lisp) and I can't seem to get my while or

GCL doesn't support ANSI CL unless you recompile it with a certain
option (and even then is still in the development stage).

Other Lisp implementations to consider can be found at:
http://www.cliki.net/Common%20Lisp%20implementation

I recommend CMUCL, SBCL, CLISP, or OpenMCL.

Alternatively, you can obtain the trial edition of a commercial
compiler, such as http://www.lispworks.com/ or http://www.franz.com/.

> until loops to work?
> Here is a very simple example of what happens!
> Can anyone tell why it doesn't recognize UNTIL as a loop type?
> Any help or info is appreciated :)

Alright, here's some other problems with this:

> >(setq v1 1)
> 1
> >(setq v3 3)
> 3

Were V1 or V3 previously defined?  The consequences of using SETQ on a
variable that doesn't exist is undefined.  Most implementations pick
some sort of behavior, but it's not consistent.  You should first
establish the variable with DEFVAR or DEFPARAMETER, and use the *name*
convention for special variables, ie:

(defvar *v1* 1)
(defvar *v3* 3)

DEFVAR will not modify an already-existing variable, DEFPARAMETER will.

> >(loop until (equal v1 v3) do (+ v1 1))

Once you manage to run this, you will be very surprised.  The + function
does /not/ perform destructive update on the variable V1.  It merely
returns a value, which you are discarding here.

(loop until (equal *v1* *v3*) do (setq *v1* (+ *v1* 1)))

is one possible alternative.  Also:

(loop until (= *v1* *v3*) do (incf *v1*))

INCF is like C's ++ operator, but more flexible.  = is the equality
operation on numbers.

-- 
; Matthew Danish <·······@andrew.cmu.edu>
; OpenPGP public key: C24B6010 on keyring.debian.org
; Signed or encrypted mail welcome.
; "There is no dark side of the moon really; matter of fact, it's all dark."