Hi!
It is a second time I post this message, now I will not put a link into it
so maybe it will get trough the spam filter...
So I have solved the 106. 4clojure problem, the Number Maze, and my
solution behaves rather strangely in the Counterclockwise REPL (and similar
on 4clojure solution checking). If I run it with the limited (range 15)
then all is good. If I run it with (range) then it runs for minutes then
finally gives the good answer. So it is lazy evaluation, otherwise it would
run forever. Why is that? Is it a codegen bug or a chunked seq problem?
(
(fn [a b]
(letfn [(nummaze [a b len]
(cond
(= len 0) false
(= a b) true
(nummaze (* 2 a) b (dec len)) true
(and (even? a) (nummaze (quot a 2) b (dec len))) true
(nummaze (+ 2 a) b (dec len)) true
:else false))]
;(first (filter #(nummaze a b %) (range 15)))))
(first (filter #(nummaze a b %) (range)))))
9 2)
A related question is that 4clojure executes (for) very slowly, I had to
rewrite several good solutions not to time out on checking. Does anybody
know why?
Thanks,
Andrew
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en