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
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
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
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
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
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=
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
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