iteration filter

Started by Dmi, July 31, 2005, 06:03:46 PM

Previous topic - Next topic

Dmi

Is there a way to simplify construction like such:
(push
  (let (s nil)
    (until (set 's (some-func)))
    s)
  db)

(push ... db) - is only envelope for example: say, I want to repeatedly got values and push only non-nil ones.



Is there a standard way to do that? Something like
(push (until (some-func)) db)
Or is there a way to write macro for such thing?

Or is it a wrong lispish style? ;-)
WBR, Dmi

Fanda

#1
I was just thinking...



Would it work for you?

1) iterate through the (some-func) and save the results to 'results

2) use command (filter) on 'results to get only non-nil ones

3) push the good ones into your list



Fanda

Dmi

#2
Hmm... nice view. I sometimes forgot that lisp is about lists.  :-)

Thanks!
WBR, Dmi