Would this work?

(defn blah [coll]

  (lazy-seq

   (when-let [s (seq coll)]

     (cons (first s) (blah (rest s))))

   ))

You can look up:

http://clojure.org/lazy

Thanks
Guru





On Thu, Dec 5, 2013 at 10:46 AM, David Simmons <shortlypor...@gmail.com>wrote:

> Hi
>
> I'd like to be able to define a function that is passed a vector of items
> and returns a function such that each time the returned function is called
> it returns the next item in my-vector.
>
> For example
>
> (def blah (my-function [1 2 3])
>
> (blah) => 1
> (blah) => 2
> (blah) => 3
>
> Is this possible?
>
> cheers
>
> Dave
>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to