From: Rolf Wester
Subject: Problem with iterate
Date: 
Message-ID: <41066472$1@news.fhg.de>
Hi,

I wanted to try the iterate package but didn't get it to work. When I do 
the following (I'm running CMUCL18e):

(require 'asdf)
(push "./iterate-1.0.7/" asdf:*central-registry*)
(asdf:oos 'asdf:load-op :iterate)

(iterate (for i from 0 below 10)
		 (collect i))

I get the error message

* ;;;Evaluating iterate


Error in function C::DO-CALL:  Malformed iterate variable spec: COLLECT.
    [Condition of type SIMPLE-ERROR]

Restarts:
   0: [ABORT] Return to Top-Level.

Debug  (type H for help)

(C::DO-CALL #<Code Object "DEFMACRO ITERATE" {104BF3DF}> 194 195 6 ...)
Source: Error finding source:
Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM:  Source file no longer 
exists:
   target:code/byte-interp.lisp.
0]

I would be very appreciative for any help.

Regards

Rolf Wester

From: Rob Warnock
Subject: Re: Problem with iterate
Date: 
Message-ID: <p4KdndtrFssU8prcRVn-pw@speakeasy.net>
Rolf Wester  <······@ilt.fraunhofer.de> wrote:
+---------------
| I wanted to try the iterate package but didn't get it to work.
| When I do the following (I'm running CMUCL18e):
|    (require 'asdf)
|    (push "./iterate-1.0.7/" asdf:*central-registry*)
|    (asdf:oos 'asdf:load-op :iterate)
|    (iterate (for i from 0 below 10)
|      (collect i))
| I get the error message:
|    Error in function C::DO-CALL:  Malformed iterate variable spec: COLLECT.
|        [Condition of type SIMPLE-ERROR]
+---------------

Are you in the CL-USER package when you do that? If so, you should
note that CMUCL already comes with an EXTENSIONS:COLLECT macro, and
that EXTENSIONS is normally USE'd by CL-USER:

    > (describe 'collect)
    COLLECT is an external symbol in the EXTENSIONS package.
    Macro-function: #<Byte function (:MACRO COLLECT) {28FA5411}>
    Macro documentation:
      Collect ({(Name [Initial-Value] [Function])}*) {Form}*
      Collect some values somehow.  Each of the collections specifies
      a bunch of things which collected during the evaluation of the
      body of the form.  The name of the collection is used to define
      a local macro, a la MACROLET...

which can be used both as a collector and, with no args, to return the
collected result:

    > (let ((list '(1 3 4 2 6 5)))
	(collect ((odds)
		  (sum-odds 0 +)
		  (evens)
		  (prod-twice-evens 1 *))
	  (dolist (i list)
	    (if (oddp i)
	      (progn (odds i) (sum-odds i))
	      (progn (evens i) (prod-twice-evens (* 2 i)))))
	  (values (odds) (sum-odds) (evens) (prod-twice-evens))))

    (1 3 5)
    9
    (4 2 6)
    384
    > 


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Rolf Wester
Subject: Re: Problem with iterate
Date: 
Message-ID: <4107cd9d$1@news.fhg.de>
Thank you for your reply. I renamed collect to collect2 in the iterate 
package and recompiled it but got the same error:

; Error in function C::DO-CALL:  Malformed iterate variable spec: COLLECT2.

Regards

Rolf


Rob Warnock wrote:
> Rolf Wester  <······@ilt.fraunhofer.de> wrote:
> +---------------
> | I wanted to try the iterate package but didn't get it to work.
> | When I do the following (I'm running CMUCL18e):
> |    (require 'asdf)
> |    (push "./iterate-1.0.7/" asdf:*central-registry*)
> |    (asdf:oos 'asdf:load-op :iterate)
> |    (iterate (for i from 0 below 10)
> |      (collect i))
> | I get the error message:
> |    Error in function C::DO-CALL:  Malformed iterate variable spec: COLLECT.
> |        [Condition of type SIMPLE-ERROR]
> +---------------
> 
> Are you in the CL-USER package when you do that? If so, you should
> note that CMUCL already comes with an EXTENSIONS:COLLECT macro, and
> that EXTENSIONS is normally USE'd by CL-USER:
> 
>     > (describe 'collect)
>     COLLECT is an external symbol in the EXTENSIONS package.
>     Macro-function: #<Byte function (:MACRO COLLECT) {28FA5411}>
>     Macro documentation:
>       Collect ({(Name [Initial-Value] [Function])}*) {Form}*
>       Collect some values somehow.  Each of the collections specifies
>       a bunch of things which collected during the evaluation of the
>       body of the form.  The name of the collection is used to define
>       a local macro, a la MACROLET...
> 
> which can be used both as a collector and, with no args, to return the
> collected result:
> 
>     > (let ((list '(1 3 4 2 6 5)))
> 	(collect ((odds)
> 		  (sum-odds 0 +)
> 		  (evens)
> 		  (prod-twice-evens 1 *))
> 	  (dolist (i list)
> 	    (if (oddp i)
> 	      (progn (odds i) (sum-odds i))
> 	      (progn (evens i) (prod-twice-evens (* 2 i)))))
> 	  (values (odds) (sum-odds) (evens) (prod-twice-evens))))
> 
>     (1 3 5)
>     9
>     (4 2 6)
>     384
>     > 
> 
> 
> -Rob
> 
> -----
> Rob Warnock			<····@rpw3.org>
> 627 26th Avenue			<URL:http://rpw3.org/>
> San Mateo, CA 94403		(650)572-2607
>