On Tue, Dec 21, 2010 at 9:12 AM, nicolas.o...@gmail.com <
nicolas.o...@gmail.com> wrote:

> (defn my-map [f l]
>  (when l
>    (cons (f (first l)) (my-map f (next l)))
>
> You can write a tail recursive version, but it would be equivalent to
> accumulating with a loop and reversing the result.
> Which you can do in Clojure.
>
> Best regards,
>
> Nicolas.
>

In my experience lazy-seqs are a reasonable replacement for the lack of TCO,
and from what I've heard that is one of the reasons they exist.

(defn a [x]
   (lazy-seq
     (cons x (b (inc x)))))

(defn b [x]
   (lazy-seq
     (cons x (a (inc x)))))

David

-- 
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

Reply via email to