From: Gary Livingston
Subject: need loop macro help
Date: 
Message-ID: <5ns061$cqh@usenet.srv.cis.pitt.edu>
Hello.

I am trying to get the loop mechanism to work with simple vectors, but all
I get are error messages!

For example, the following is supposed to be correct, according to several
lisp references, including Steele:

(loop for i across (the simple-vector) #(1 3 10 2) do (print i)) 

However, I get the following error message:

>>Error: Loop macro: Random atom found where FOR (or AS) preposition expected:
             (... FOR I ACROSS (THE SIMPLE-VECTOR) #(1 3 10 2) DO (PRINT I) )

Does anyone have any good suggestions?

Thanks,
Gary Livingston

From: Lyman S. Taylor
Subject: Re: need loop macro help
Date: 
Message-ID: <5ns1en$qfl@pravda.cc.gatech.edu>
In article <··········@usenet.srv.cis.pitt.edu>,
Gary Livingston <····@cs.pitt.edu> wrote:
>Hello.
>
>I am trying to get the loop mechanism to work with simple vectors, but all
>I get are error messages!

>For example, the following is supposed to be correct, according to several
>lisp references, including Steele:
>
>(loop for i across (the simple-vector) #(1 3 10 2) do (print i)) 

  Ummmm,  You sure that wasn't suppose to be:

  (loop for i across (the simple-vector #(1 3 10 2 )) do (print i ))

  

  The construct  "(the simple-vector  .... ) " is a type declaration on the
  result of the expression that goes were the "..." is. 
  The loop macro syntax checking raises the error before the fact that 
  (the simple-vector)  is illegal can be. :-) 



-- 

Lyman S. Taylor			"Because no matter where you go,
(·····@cc.gatech.edu)			there you are."
						Buckaroo Banzai
From: Gary Livingston
Subject: Re: need loop macro help
Date: 
Message-ID: <5ns32f$d9d@usenet.srv.cis.pitt.edu>
Even without the type descriptor I get the same error message.

(loop for i across #(1 2 10 3) do (print i))
will produce the same error message:

>>Error: Loop macro: Random atom found where FOR (or AS) preposition expected:
             (... FOR I ACROSS #(1 2 10 3) DO (PRINT I) )   


Gary

Lyman S. Taylor (·····@cc.gatech.edu) wrote:
: In article <··········@usenet.srv.cis.pitt.edu>,
: Gary Livingston <····@cs.pitt.edu> wrote:
: >Hello.
: >
: >I am trying to get the loop mechanism to work with simple vectors, but all
: >I get are error messages!

: >For example, the following is supposed to be correct, according to several
: >lisp references, including Steele:
: >
: >(loop for i across (the simple-vector) #(1 3 10 2) do (print i)) 

:   Ummmm,  You sure that wasn't suppose to be:

:   (loop for i across (the simple-vector #(1 3 10 2 )) do (print i ))

:   

:   The construct  "(the simple-vector  .... ) " is a type declaration on the
:   result of the expression that goes were the "..." is. 
:   The loop macro syntax checking raises the error before the fact that 
:   (the simple-vector)  is illegal can be. :-) 



: -- 

: Lyman S. Taylor			"Because no matter where you go,
: (·····@cc.gatech.edu)			there you are."
: 						Buckaroo Banzai
From: Dave Seaman
Subject: Re: need loop macro help
Date: 
Message-ID: <5ns6rj$h5s@seaman.cc.purdue.edu>
In article <··········@usenet.srv.cis.pitt.edu>,
Gary Livingston <····@cs.pitt.edu> wrote:
>Even without the type descriptor I get the same error message.
>
>(loop for i across #(1 2 10 3) do (print i))
>will produce the same error message:
>
>>>Error: Loop macro: Random atom found where FOR (or AS) preposition expected:
>             (... FOR I ACROSS #(1 2 10 3) DO (PRINT I) )   

You didn't say what version of Lisp you were using, but it looks as if the
ACROSS preposition is not accepted.  It works fine in MCL, either as

	(loop for i across #(1 2 10 3) do (print i))
or
	(loop for i across (the simple-vector #(1 2 10 3)) do (print i))

-- 
Dave Seaman			·······@purdue.edu
      ++++ stop the execution of Mumia Abu-Jamal ++++
    ++++ if you agree copy these lines to your sig ++++
++++ see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ++++
From: Gary Livingston
Subject: Re: need loop macro help
Date: 
Message-ID: <5nscjv$eft@usenet.srv.cis.pitt.edu>
It seems that the lisp version may have a problem with ACROSS.  Is there
a patch for Lucid Common Lisp / Dec systems that has this fixed?

Thanks for the quick help,
Gary

Dave Seaman (···@seaman.cc.purdue.edu) wrote:
: In article <··········@usenet.srv.cis.pitt.edu>,
: Gary Livingston <····@cs.pitt.edu> wrote:
: >Even without the type descriptor I get the same error message.
: >
: >(loop for i across #(1 2 10 3) do (print i))
: >will produce the same error message:
: >
: >>>Error: Loop macro: Random atom found where FOR (or AS) preposition expected:
: >             (... FOR I ACROSS #(1 2 10 3) DO (PRINT I) )   

: You didn't say what version of Lisp you were using, but it looks as if the
: ACROSS preposition is not accepted.  It works fine in MCL, either as

: 	(loop for i across #(1 2 10 3) do (print i))
: or
: 	(loop for i across (the simple-vector #(1 2 10 3)) do (print i))

: -- 
: Dave Seaman			·······@purdue.edu
:       ++++ stop the execution of Mumia Abu-Jamal ++++
:     ++++ if you agree copy these lines to your sig ++++
: ++++ see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ++++
From: Barry Margolin
Subject: Re: need loop macro help
Date: 
Message-ID: <5nsp8s$959@tools.bbnplanet.com>
In article <··········@seaman.cc.purdue.edu>,
Dave Seaman <···@seaman.cc.purdue.edu> wrote:
>You didn't say what version of Lisp you were using, but it looks as if the
>ACROSS preposition is not accepted.  It works fine in MCL, either as

ACROSS was an invention of X3J13, not part of the original MIT LOOP macro.
LOOP implementations that predate CLtL2 generally don't have it.

-- 
Barry Margolin, ······@bbnplanet.com
BBN Corporation, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>
From: Steven M. Haflich
Subject: Re: need loop macro help
Date: 
Message-ID: <33A19568.2778@franz.com>
Gary Livingston wrote:
 
> For example, the following is supposed to be correct, according to several
> lisp references, including Steele:
> 
> (loop for i across (the simple-vector) #(1 3 10 2) do (print i))
> 
> However, I get the following error message:
> 
> >>Error: Loop macro: Random atom found where FOR (or AS) preposition expected:
>              (... FOR I ACROSS (THE SIMPLE-VECTOR) #(1 3 10 2) DO (PRINT I) )

I think you want something like:

   (loop for i across (the simple-vector #(1 2 10 2)) do (print i))
From: Rainer Joswig
Subject: Re: need loop macro help
Date: 
Message-ID: <joswig-ya023180001306972218250001@news.lavielle.com>
In article <··········@usenet.srv.cis.pitt.edu>, ····@cs.pitt.edu (Gary
Livingston) wrote:

> Hello.
> 
> I am trying to get the loop mechanism to work with simple vectors, but all
> I get are error messages!
> 
> For example, the following is supposed to be correct, according to several
> lisp references, including Steele:
> 
> (loop for i across (the simple-vector) #(1 3 10 2) do (print i)) 
> 
> However, I get the following error message:
> 
> >>Error: Loop macro: Random atom found where FOR (or AS) preposition expected:
>              (... FOR I ACROSS (THE SIMPLE-VECTOR) #(1 3 10 2) DO (PRINT I) )
> 
> Does anyone have any good suggestions?

Sure:

(loop for i across (the simple-vector #(1 3 10 2))
      do (print i)) 

or with declaration for i

(loop for i fixnum across (the simple-vector #(1 3 10 2))
      do (print i))

-- 
http://www.lavielle.com/~joswig/