## series-users

 [Series-users] A more general question. From: Robin Lee Powell - 2008-08-11 07:37:31 ```Is there any way to expand a series? What I would like to do is something (very loosely) like this: (let ((orig #z(1 -2 3 4 -5 6)) ([do some other series stuff on orig]) (x (choose-if #'minusp #z(1 -2 3 4 -5 6)))) (alter x [turn -N into -N ... 0, thus changing the length of the series])) In other words, given a series, I want to replace some of the values with a bunch more values, but without losing the lazy-ness of the library. Is there any way to do this at all? -Robin -- Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo Proud Supporter of the Singularity Institute - http://singinst.org/ http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/ ```
 Re: [Series-users] A more general question. From: Raymond Toy (RT/EUS) - 2008-08-14 17:48:52 ```Robin Lee Powell wrote: > Is there any way to expand a series? What I would like to do is > something (very loosely) like this: > > (let ((orig #z(1 -2 3 4 -5 6)) > ([do some other series stuff on orig]) > (x (choose-if #'minusp #z(1 -2 3 4 -5 6)))) > (alter x [turn -N into -N ... 0, thus changing the length of > the series])) > > In other words, given a series, I want to replace some of the values > with a bunch more values, but without losing the lazy-ness of the > library. > > Is there any way to do this at all? Don't know. But this do a large part of what you want, except to fill in the nils with the desired values: (spread (map-fn t #'(lambda (x) (if (minusp x) (abs x) 0)) #z(1 -2 3 4 -5 6)) #z(1 -2 3 4 -5 6)) => #Z(1 NIL NIL -2 3 4 NIL NIL NIL NIL NIL -5 6) I think you wanted #z(1 -2 -1 0 3 4 -5 -4 -3 -2 -1 0 6) Just need to get rid of the negative numbers and fill in the NILs with the desired values. Perhaps that will provide a hint on what to do. Ray ```