From: Ola Andersson
Subject: Need help with symbolics loop!
Date: 
Message-ID: <31595F66.390D@ling.umu.se>
Hi,

I am using GCL v1.1 and the symbolics loop macro from the CMU lisp archives,
but I still get an error with this:

(loop for index first (1- (length z-imag)) then (1- index)
                        when (or (zerop index)
                        (/= (aref z-imag index) 0.0))
                  do (return index))

Error: FIRST is an unknown keyword in FOR or AS clause in LOOP.
       Current LOOP context: FOR INDEX FIRST (1- (LENGTH Z-IMAG)) THEN.


Note: I have patched the loop macro with this:
#+kcl
(progn
  (defmacro special-operator-p (x) `(special-form-p ,x))
  (deftype real () '(or rational float))
)

-- 
Ola Andersson                            Email: ····@ling.umu.se
Research Engineer                        WWW:   http://www.ling.umu.se/~rand
Department of Phonetics                  Phone: +46 90 16 95 48
Umea University                          Fax:   +46 90 16 63 77

From: Micheal S. Hewett
Subject: Re: Need help with symbolics loop!
Date: 
Message-ID: <4jc8ut$i4f@arachne.cs.utexas.edu>
····@ling.umu.se (Ola Andersson) writes:
>;
>;
>;(loop for index first (1- (length z-imag)) then (1- index)
>;                        when (or (zerop index)
>;                        (/= (aref z-imag index) 0.0))
>;                 do (return index))


Just rewrite it as:

  (or (position 0.0 z-imag :test #'/= :from-end T) 0)

The (or ... 0) duplicates the original code, but looks
like a kluge.  You can probably eliminate it by examining
the code that follows.

Mike Hewett
(······@cs.utexas.edu)
From: Mike McDonald
Subject: Re: Need help with symbolics loop!
Date: 
Message-ID: <4jcd30$m5h@fido.asd.sgi.com>
In article <·············@ling.umu.se>,
	Ola Andersson <····@ling.umu.se> writes:
>Hi,
>
>I am using GCL v1.1 and the symbolics loop macro from the CMU lisp archives,
>but I still get an error with this:
>
>(loop for index first (1- (length z-imag)) then (1- index)
>                        when (or (zerop index)
>                        (/= (aref z-imag index) 0.0))
>                  do (return index))
>
>Error: FIRST is an unknown keyword in FOR or AS clause in LOOP.
>       Current LOOP context: FOR INDEX FIRST (1- (LENGTH Z-IMAG)) THEN.

  FIRST is =.


(loop for index = (1- (length z-imag)) then (1- index)
      when (or (zerop index)
	       (/= (aref z-imag index) 0.0))
      do (return index))

  Works with CMU-CL anyway.

  Mike McDonald
  ·······@engr.sgi.com