I have much sympathy for LISP and Clojure but have not that much experience with it. So, to stay in touch with it, here is my Clojure program, mostly a one-to-one translation of my latest Haskell program:
(nskaprekar.core(:gen-class))(use'[clojure.math.numeric-tower:asmath])(defnisKaprekar?[basen](let[sqr(*nn)](->>(map#(math/exptbase%1)(range)); list of divisors(drop-while#(<=%1n)); discard if too small(take-while#(<%1sqr)); discard if too big(some#(=0(mod(-sqrn)(-%11))))))); remainder = 0? <=> kaprekar(defnfindKaprekar[basen](->>(rangen)(filter#(isKaprekar?base%1))(cons1)))(defn-main"Finding the Kaprekar number base 10 up to 10000000"[&args](time(print(findKaprekar10(math/expt108)))))
I really like the threading macros. :-) Computing up to 10^8 , the execution time of the jar file is ten times the execution time of the compiled Haskell. Did I make a serious mistake, performance-wise? Of course, there is the JVM, but I didn't expect this program to be slower with factor 10.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I have much sympathy for LISP and Clojure but have not that much experience with it. So, to stay in touch with it, here is my Clojure program, mostly a one-to-one translation of my latest Haskell program:
I really like the threading macros. :-) Computing up to 10^8 , the execution time of the jar file is ten times the execution time of the compiled Haskell. Did I make a serious mistake, performance-wise? Of course, there is the JVM, but I didn't expect this program to be slower with factor 10.