From: ·············@hotmail.com
Subject: Help with series
Date: 
Message-ID: <8f34d587-96d7-4874-b5aa-fd3209670fc6@l1g2000hsa.googlegroups.com>
I'm new to Lisp.  I'm' trying to use the Series library with SBCL.
I'm working on code that could benefit from lazy evaluation.  I've run
into a warning I don't understand.  I hope someone can shed some light
on what causes this warning and/or suggest a work around.

CL-USER> (let ((s (scan-range :length 5)))
		   (iterate ((e s))
					(print e)))
Warning 28 in series expression:
(ITERATE ((E S)) (PRINT E))
Non-series to series data flow from:
S
to:
(MAPPING ((E S)) (PRINT E)); in: LAMBDA NIL
;     (ITERATE ((E S)) (PRINT E))
;
; caught WARNING:
;   (in macroexpansion of (ITERATE # #))
;   (hint: For more precise location, try *BREAK-ON-SIGNALS*.)
;
;
; compilation unit finished
;   caught 1 WARNING condition

0
1
2
3
4
NIL

However, if I replace iterate with mapping the warning goes away.

CL-USER> (let ((s (scan-range :length 5)))
		   (mapping ((e s))
					(print e)))

0
1
2
3
4
#Z(0 1 2 3 4)

Also, if I ellimate the variable "s" an put the series directly into
the iterate form there's no warning.

CL-USER> (iterate ((e (scan-range :length 5)))
				  (print e))

0
1
2
3
4
NIL
CL-USER>

Please help!  Thank,

Jeff

From: David Golden
Subject: Re: Help with series
Date: 
Message-ID: <vDjej.23987$j7.447081@news.indigo.ie>
·············@hotmail.com wrote:

> Please help!  Thank,

Hmm. Haven't investigated the why, but it goes away if you  
remember the slightly unusual  "(series::install)" 
step of using series.  No idea if that's still the canonical
way to use series - I notice the install routine is not
exported from package series, which might be a hint that it's 
not, but series integration with lisp works slightly better if
you use it as it will add macro characters for you so that
you can use series literals, for example:

Try:

; the relevant ASDF incantation if your require 
; isn't hooked.
(require :series)  

; note I'm not using series in the defpackage, 
; the install routine below imports...
(defpackage :series-user (:use :common-lisp))
(in-package :series-user)
(series::install)

(let ((s (scan-range :length 5)))
               (iterate ((e s))
                        (print e)))

(iterate ((e #z(1 3 5 monkey bananas)))
                      (print e))
From: David Golden
Subject: Re: Help with series
Date: 
Message-ID: <ipkej.23988$j7.447066@news.indigo.ie>
David Golden wrote:

> ·············@hotmail.com wrote:
> 
>> Please help!  Thank,
> 
> Hmm. Haven't investigated the why, but it goes away if you
> remember the slightly unusual  "(series::install)"
> step of using series.

Duh (in my defence, it's 5:30am on new year's...), 
series supplies extended binding forms, e.g. an extended 
LET , which is used if you series::install as I showed.