i have a function that returns a seq of sets, each containing the
digits corresponding to the multiples (2x...6x) for a given number
like so:

(defn mulseq [n]
(let [n (int n)]
(map #(set (str (* n %))) [2 3 4 5 6])))

user> (mulseq 24)
=> (#{\4 \8} #{\2 \7} #{\6 \9} #{\0 \1 \2} #{\1 \4})

(mulseq  1200)
=> (#{\0 \2 \4} #{\0 \3 \6} #{\0 \4 \8} #{\0 \6} #{\0 \2 \7})

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]

Restarts:
 0: [ABORT] Return to SLIME's top level.

Backtrace:
  0: clojure.lang.RT.intCast(RT.java:900)
  1: user$mulseq__2095.invoke(NO_SOURCE_FILE:1)
  2: user$eval__2176.invoke(NO_SOURCE_FILE:1)
  3: clojure.lang.Compiler.eval(Compiler.java:4642)
  4: clojure.core$eval__5254.invoke(core.clj:2031)
  5: swank.commands.basic$eval_region__907.invoke(basic.clj:40)
  6: swank.commands.basic$eval_region__907.invoke(basic.clj:31)
  7: swank.commands.basic
$eval__927$listener_eval__929.invoke(basic.clj:54)
  8: clojure.lang.Var.invoke(Var.java:359)
  9: user$eval__2173.invoke(NO_SOURCE_FILE)
 10: clojure.lang.Compiler.eval(Compiler.java:4642)
 11: clojure.core$eval__5254.invoke(core.clj:2031)
 12: swank.core$eval_in_emacs_package__455.invoke(core.clj:59)
 13: swank.core$eval_for_emacs__533.invoke(core.clj:128)
 14: clojure.lang.Var.invoke(Var.java:367)
 15: clojure.lang.AFn.applyToHelper(AFn.java:179)
 16: clojure.lang.Var.applyTo(Var.java:476)
 17: clojure.core$apply__4379.invoke(core.clj:434)
 18: swank.core$eval_from_control__458.invoke(core.clj:66)
 19: swank.core$eval_loop__461.invoke(core.clj:71)
 20: swank.core$spawn_repl_thread__595$fn__627$fn__629.invoke(core.clj:
183)
 21: clojure.lang.AFn.applyToHelper(AFn.java:171)
 22: clojure.lang.AFn.applyTo(AFn.java:164)
 23: clojure.core$apply__4379.invoke(core.clj:434)
 24: swank.core$spawn_repl_thread__595$fn__627.doInvoke(core.clj:180)
 25: clojure.lang.RestFn.invoke(RestFn.java:402)
 26: clojure.lang.AFn.run(AFn.java:37)
 27: java.lang.Thread.run(Thread.java:637)

i'm sure this is trivial...please help. By way of additional context,
i want to wrap this in (drop-until #(not (distinct? %)) ...) to find
the first number whose 2x-6x multiples have the same set of digits in
a different order. i realize there may be a hundred better ways to do
this - n00b alert...

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