Re: complex numbers in clojure

2014-08-16 Thread Mikera
There is really no perfect numerical type: - primitive doubles are best if you care about performance and reasonably good precision (but no complex numbers!) - boxed Doubles are needed in some circumtances, e g. storage in collections, passing to dynamic code - something like

CtorReader bug?

2014-08-16 Thread dennis zhuang
user= #java.lang.String[hello world] hello world user= #java.lang.String[(byte-array) utf8] IllegalArgumentException No matching ctor found for class java.lang.String clojure.lang.Reflector.invokeConstructor (Reflector.java:183) It seems that the CtorReader

Re: CtorReader bug?

2014-08-16 Thread dennis zhuang
Sorry,the error example must be: user= #java.lang.String[(byte-array 10) utf8] IllegalArgumentException No matching ctor found for class java.lang.String clojure.lang.Reflector.invokeConstructor (Reflector.java:183) 2014-08-16 19:59 GMT+08:00 dennis zhuang killme2...@gmail.com: user=

Re: CtorReader bug?

2014-08-16 Thread Nicola Mometto
It's by design, see the section on ctor literals http://clojure.org/reader#toc1 The elements in the vector part are passed unevaluated to the relevant constructor. Nicola dennis zhuang writes: user= #java.lang.String[hello world] hello world user= #java.lang.String[(byte-array) utf8]

Re: CtorReader bug?

2014-08-16 Thread dennis zhuang
Got it. Thanks for your quick reply. 2014-08-16 20:14 GMT+08:00 Nicola Mometto brobro...@gmail.com: It's by design, see the section on ctor literals http://clojure.org/reader#toc1 The elements in the vector part are passed unevaluated to the relevant constructor. Nicola dennis zhuang

alter-var-root, what am I doing wrong?

2014-08-16 Thread Kevin webster
Can someone explain why this is not altering the *data-readers* dynamic var? Does this work for anyone else? Using 1.6.0 (assert (= {} *data-readers*)) ;; nil (alter-var-root (var *data-readers*) (fn [_] {:test 2})) ;; {:test 2} (assert (= {:test 2} *data-readers*)) ;; AssertionError (assert

Re: complex numbers in clojure

2014-08-16 Thread Jan-Paul Bultmann
I agree that Clojure could really use an imaginary number type. The best place to start with this might be `clojure.math.numeric-tower` because it already provides a `MathFunctions` protocol that defines a square root operation. Cheers Jan On 15 Aug 2014, at 19:54, Maik Schünemann

Re: alter-var-root, what am I doing wrong?

2014-08-16 Thread Nicola Mometto
Because in the repl you're using a thread-local value of *data-readers*, not the var root, this is because the repl is executed under (binding [*data-readers ..] ..) If you try to set! *data-readers* instead, you'll see what you expect. Consider: user= (def ^:dynamic x nil) #'user/x user= x nil

Re: alter-var-root, what am I doing wrong?

2014-08-16 Thread Kevin webster
Ah yes, I see that here: https://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/main.clj#L64-L86 Thanks for the quick response! On Saturday, August 16, 2014 1:36:11 PM UTC+1, Nicola Mometto wrote: Because in the repl you're using a thread-local value of *data-readers*, not

Re: FYI: for Clojure people stuck with some Java, use DCEVM

2014-08-16 Thread Colin Fleming
On 15 August 2014 19:23, Sean Corfield s...@corfield.org wrote: Could you elaborate on this Colin? Sure. IntelliJ uses an IoC container, and you declare your implementations of their extensions in an XML file, like this

Re: complex numbers in clojure

2014-08-16 Thread Maik Schünemann
I agree with mikera on this, the standard numeric abstraction have to be able to fulfill all performance needs. This definitly excludes multimethods (algo.generic) and protocols/interface-calls (numeric-tower). (Imagine multiplying two 5000x5000 matrices and having to go through a protocol for

[ANN] lein-plz 0.1.1 - Add dependencies quickly

2014-08-16 Thread john walker
Hello everyone. This is a lein plugin that helps you add dependencies to projects pretty quickly. The git repo is here: https://github.com/johnwalker/lein-plz Basically, you write something like this: lein new foo cd foo lein plz add cljs async match jdbc and get this: (defproject foo