Re: Test for whether a function accepts a particular arity.

2010-10-29 Thread AlexK
You can use some Reflection to find out if the function has implemented the matching invoke(args*) method see: http://gist.github.com/654851 On 29 Okt., 07:02, Ken Wesson kwess...@gmail.com wrote: (defn accepts-arity? [n f]   (reduce     #(or        %1        (= n (count %2))        (and

Re: ?: promotion of integral types

2010-05-05 Thread AlexK
is that the primitive versions return primitives and thus cannot overflow to Bignums, so they throw an exception. This 'bug' is unsolvable for now (until we get Fixnums on the JVM) without sacrificing the speed of primitive math. AlexK On 5 Mai, 14:44, Sean Devlin francoisdev...@gmail.com wrote: Yeah

Re: Inconsistent behavior in 1.2.0-master w.r.t. previous versions

2010-01-27 Thread AlexK
which extends Obj directly, so those work. No idea why PersistentSet works however. AlexK -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated

Re: Does clojure have same problem as groovy private fields and private methods are not private

2009-12-24 Thread AlexK
Clojure solves this problem in a very simple way: Not at all. Two Reasons: There is no way to create a class with private members in clojure. 'private members' exist because of lexical scoping and don't require special constructs like 'private' etc. (javascript has 'private members' too because

Re: Eval question

2009-12-21 Thread AlexK
clojure is a lisp, so it has a real eval, that works on datastructures, not strings eg. (eval '(+ 1 2)) ; = 3 (eval (list (symbol +) 1 2)) ; = 3 whenever you write someting like (def x 3), it gets turned into a list with the symbol 'def, the symbol 'x and the number 3, which then is passed to

Re: Datatypes and Protocols - early experience program

2009-11-13 Thread AlexK
Hi everybody, after playing around with protocols datatypes, I found them very fun to use. Some questions: Performance I don't see (with my limited benchmarking) any significant difference between multifns and protocolfns: user= (defprotocol Test (protocol-fn [it] Protocol-fn)) Test user=

Re: Datatypes and Protocols - early experience program

2009-11-13 Thread AlexK
On 13 Nov., 17:07, Rich Hickey richhic...@gmail.com wrote: This kind of do-nothing microbenchmarking demonstrates nothing. Protocol dispatching is significantly faster than multimethod dispatching, and I haven't even looked into call-site optimization. Protocol dispatch is not as fast as

Re: Transient Data Structures

2009-08-07 Thread AlexK
On 7 Aug., 10:07, Patrick Sullivan wizardofwestma...@gmail.com wrote: Am I doing something silly here or is this a bug? You probably are using conj! for the side-effect, but after growing the hashmap to size 8 conj! returns a different map. user (def foo (transient {1 1 2 2 3 3 4 4 5 5 6 6