Re: Clojure CLR and System.Double Behavior

2012-11-29 Thread dmiller
user=> (defn f [^Double x] x) #'user/f user=> (defn g [^double x] x) #'user/g user=> (f 1.0) 2.15078317008181E-316# GASP! user=> (g 1.0) 1.0# CROWD APPLAUDS! As you can see, there is a workaround: use ^double, not ^Double. This

Re: (iterate inc 2) vs (drop 2 (range)) in corecursion

2012-11-29 Thread Ulrich
You are right demanding a base case. I don't deny that any more. As stated above, me as a beginner, experimenting for experience, took the well-known Fibonacci corecursion (with base case) as guidance in setting my first prime corecursion code with range, and then reduced the base case from '(2

Re: [ANN] modern-cljs - tutorial 8 and CLJS patch

2012-11-29 Thread CA
The tuts. are awesome! On Wednesday, November 28, 2012 8:33:56 AM UTC+1, Mimmo Cosenza wrote: > > Thanks Michael, > hope to mantain myself to your generous judgment. > > mimmo (it's my nickname) > > > On Nov 27, 2012, at 9:09 PM, Michael Klishin > > > wrote: > > 2012/11/27 Giacomo Cosenza > >

Re: CLJS: UUID generator for ClojureScript

2012-11-29 Thread David Nolen
Also note that testing with the Rhino REPL is not informative about performance in anyway - you absolutely need to test your code against the modern JS engines - V8, JavaScriptCore, or SpiderMonkey (with JIT turned on). For code like this they are often 100X faster if not far greater than that. O

Re: CLJS: UUID generator for ClojureScript

2012-11-29 Thread Frank Siebenlist
Thanks for the feedback! Defining the two helper functions outside of the function-scope doesn't seem to have any effect on the performance numbers. …but I have to confess that all testing was done at the repl without any optimization so far… -FS. On Nov 29, 2012, at 8:36 AM, David Nolen w

Clojure CLR and System.Double Behavior

2012-11-29 Thread ffailla
I have discovered some odd behavior when type-hinting fns with ^System.Double: user=> (defn bar [^System.Double d] d) #'user/bar user=> (bar 1.2) 2.35293190771409E-316 user=> (bar 1) 2.35069794048985E-316 The same behavior occurs when extending double via extend-protocol or extend-type: user=>

Re: CLJS: UUID generator for ClojureScript

2012-11-29 Thread David Nolen
Oh though before you lift them out by hand - I would double check that :simple optimizations doesn't already do this for you :) On Thu, Nov 29, 2012 at 1:25 AM, Frank Siebenlist < frank.siebenl...@gmail.com> wrote: > I need UUIDs in my CLJS code… > > cljs.core does include a UUID type, but no ge

Re: CLJS: UUID generator for ClojureScript

2012-11-29 Thread David Nolen
closures inside the body of a function are not free in JS. I would lift those helpers out. In general I see no benefit to writing your "fast" code in JS - all the facilities for writing efficient code are available in ClojureScript itself. I agree that it's not completely clear what subset of Cloju

Re: call superclass method in classes created by Clojure?

2012-11-29 Thread David Powell
proxy is basically a more interop-oriented version of reify though, and it can extend classes, and you can use proxy-super to call superclass methods from there. On Nov 29, 2012 1:40 PM, "Vladimir Tsichevski" wrote: > Thanks > > On Thursday, November 29, 2012 5:33:20 PM UTC+4, David Powell wrote:

Re: call superclass method in classes created by Clojure?

2012-11-29 Thread Vladimir Tsichevski
Thanks On Thursday, November 29, 2012 5:33:20 PM UTC+4, David Powell wrote: > > > reify can only implement interfaces and protocols, so there aren't any > superclass methods to call (except the ones in Object I guess). > > > On Thu, Nov 29, 2012 at 1:30 PM, Vladimir Tsichevski > > > wrote: > >>

Re: call superclass method in classes created by Clojure?

2012-11-29 Thread David Powell
reify can only implement interfaces and protocols, so there aren't any superclass methods to call (except the ones in Object I guess). On Thu, Nov 29, 2012 at 1:30 PM, Vladimir Tsichevski wrote: > Thanks, > > is there something like that for reify? > > > On Thursday, November 29, 2012 2:52:56 AM

Re: call superclass method in classes created by Clojure?

2012-11-29 Thread Vladimir Tsichevski
Thanks, is there something like that for reify? On Thursday, November 29, 2012 2:52:56 AM UTC+4, Meikel Brandmeyer (kotarak) wrote: > > Am 28.11.12 23:10, schrieb Vladimir Tsichevski: > > Is it possible? > See exposes-methods in documentation for gen-class. > > > http://clojure.github.com/clo

Re: help choosing dev environment for clojure

2012-11-29 Thread sai rinkai
CLOOJ is the best. Simple, efficient, no installation, everything you need (of course you also need lein). If you want to have headaches trying everything around you'd better do it after have learned the basics otherwise you may give up believe me. http://dev.clojure.org/display/doc/getting+star

Re: (iterate inc 2) vs (drop 2 (range)) in corecursion

2012-11-29 Thread Christophe Grand
On Wed, Nov 28, 2012 at 5:24 PM, Ulrich wrote: > Then I found the solution with "iterate" and then further reduced starting > values to '(2) and then to '() what worked as well, > as every? returns true for empty sequences, what is right from a logical > point of view too. And with '() as start e