(defn foo [z-r z-i c-r c-i bailout max-iters]
(let [G__12819 (double c-r)
G__12820 (double c-i)
G__12817 (double -1)
G__12818 (double 2)
mi (int max-iters)
b (double (* bailout bailout))]
(loop [G__12815 (double z-r)
G__12816 (double z-i)
i (int 0)]
(if (> i mi)
:iters
(if (> (+ (* G__12815 G__12815) (* G__12816 G__12816)) b)
i
(recur
(+ (* G__12815 G__12815) (* G__12817 G__12816 G__12816)
G__12819)
(+ (* G__12818 G__12815 G__12816) G__12820)
(unchecked-inc i)))))))
#<CompilerException java.lang.RuntimeException:
java.lang.IllegalArgumentException: recur arg for primitive local:
G__12815 must be matching primitive (foo.clj:391)>
The recur arg in question is (+ (* G__12815 G__12815) (* G__12817
G__12816 G__12816) G__12819) all of whose operands are doubles.
This seems buggy.
(If you're asking why the meaningless names, it's because this is
actually adapted from the output of macroexpand-1. I have a macro to
turn symbolic mathematical expressions into optimized iteration loops.
It's not ready for prime-time yet; besides this problem, it doesn't do
common subexpression elimination, so for instance there's two of (*
G__12815 G__12815) in there.
But: this is the slightly-massaged output of (make-complex-double-
iteration-loop (:= z (+ c (** z 2)))) and close inspection will reveal
that it actually is a loop to iterate that, as a function of complex
numbers, until the modulus exceeds one limit or the iteration count
exceeds another limit. That I have a macro turning (:= z (+ c (** z
2))) into the above code is, I think, a significant accomplishment in
the area of math DSLs. And I did it in under five hours.)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---