On Wednesday 05 May 2010 04:34:04 venkat wrote:

> when i use this on single values, it works, but doesnt if i try to use
> it over a lazy sequence
> 
> user> (take 3 (mulseq (iterate inc 5)))
> ; Evaluation aborted.
> 
> clojure.lang.Cons cannot be cast to java.lang.Character
>   [Thrown class java.lang.ClassCastException]

You pass a seq to the function which expects a single number.  What you
really want is to pass each number in the seq to you function and
collect the results.  Something like:

--8<---------------cut here---------------start------------->8---
user> (take 3 (map mulseq (iterate inc 5)))
((#{\0 \1} #{\1 \5} #{\0 \2} #{\2 \5} #{\0 \3})
 (#{\1 \2} #{\1 \8} #{\2 \4} #{\0 \3} #{\3 \6})
 (#{\1 \4} #{\1 \2} #{\2 \8} #{\3 \5} #{\2 \4}))
user> 
--8<---------------cut here---------------end--------------->8---

HTH,
Tassilo

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