Yes:

user> (defn my-flatten [x]
  (if (coll? x) (mapcat my-flatten x) [x]))
#'user/my-flatten
user> (my-flatten (take 4000 (iterate vector [])))

(stack overflow)

On Wed, Aug 29, 2012 at 2:03 PM, Erlis Vidal <er...@erlisvidal.com> wrote:
> Hi group,
>
> Will this recursion cause stack overflow?
>
> (defn my-flatten [x]
>   (if (coll? x) (mapcat my-flatten x) [x]))
>
> If yes, how can I do a recursive call when passing the function as a
> parameter to another function, like in this case with mapcat?
>
> Thanks,
> Erlis
>
> --
> 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



-- 
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks,
which may be sweet, aromatic, fermented or spirit-based. ... Family
and social life also offer numerous other occasions to consume drinks
for pleasure." [Larousse, "Drink" entry]

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