Re: defrecord, equality, hashing, and performance

2015-06-12 Thread Mars0i
On Thursday, June 11, 2015 at 2:19:56 PM UTC-5, Andy Fingerhut wrote: You can override hashCode and/or hasheq methods in deftype. I've been unable to do it. Is there something special needed to allow this to work? user= (defrecord Foo [x] Object (hashCode [this] 42)) CompilerException

Re: defrecord, equality, hashing, and performance

2015-06-12 Thread Mark Engelberg
Related to this, another thing I would like Clojure to provide is an easy way to opt-in for map-like function application for defrecords. Right now, Clojure doesn't implement function application for records, and it is a glaring incompatibility that causes bugs when you switch back and forth

Re: defrecord, equality, hashing, and performance

2015-06-12 Thread Mark Engelberg
So just to explain this a little more, recently I wanted something record-like with custom hashing and equality for my ubergraph library. Unfortunately, you can't do this with defrecord, and starting from deftype and re-implementing all the map-like semantics from scratch is a total pain. So what

Re: defrecord, equality, hashing, and performance

2015-06-12 Thread Mars0i
On Thursday, June 11, 2015 at 2:12:12 PM UTC-5, puzzler wrote: Zach Tellman's potemkin library includes several useful ways to tweak deftypes and defrecords. I wish Clojure itself provided more ways to do this, but in the meantime, potemkin is the best way to create something custom, like

Re: defrecord, equality, hashing, and performance

2015-06-12 Thread Andy Fingerhut
deftype allows you to override hashCode and/or hasheq (I believe defaulting to identity-based implementations from java.lang.Object). defrecord does not. As mentioned in another message, potemkin may provide easier building blocks to build on than deftype. Andy On Thu, Jun 11, 2015 at 11:10

Re: defrecord, equality, hashing, and performance

2015-06-12 Thread Sun Ning
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Prismatic has some document for deftype/defrecord/map, hope it's useful to you: https://github.com/Prismatic/eng-practices/blob/master/clojure/20130926-data-representation.md On 06/12/2015 02:36 AM, Mars0i wrote: I think that the following is all

Re: defrecord, equality, hashing, and performance

2015-06-12 Thread Alex Miller
Re IFn support for defrecord, I don't actually know the reason that's not built-in. I am not aware of an existing ticket for this. Of course, at this point many people patch it in, so we would need to consider potential breakage from that. -- You received this message because you are

Boot: How to run with the clojure version declared in the :dependencies?

2015-06-12 Thread Tassilo Horn
Hi all, I'm toying around with boot and try to get my leiningen config converted to it. My build.boot contains --8---cut here---start-8--- (set-env! :resource-paths #{src resources} :dependencies '[[org.clojure/clojure 1.7.0-RC1] ...])

Boot: CLASSPATH troubles with javax.tools.JavaCompiler

2015-06-12 Thread Tassilo Horn
Hi all, I'm toying around with boot and try to get my leiningen config converted to it. My Clojure project uses a third-party Java library which uses a javax.tools.JavaCompiler to compile classes at runtime. By default, such a JavaCompiler compiles with the CLASSPATH which is the value of the

Re: defrecord, equality, hashing, and performance

2015-06-12 Thread Fluid Dynamics
On Friday, June 12, 2015 at 11:46:17 AM UTC-4, Mars0i wrote: Oh, yes, and that's an interesting idea to wrap a record in an atom or delay. For my present uses that would be more trouble than it's worth, but it's something worth keeping in mind for other situations. Putting a unique

`rational?` `decimal?` Am I misunderstanding these? (also `float?`)

2015-06-12 Thread Gary Verhaegen
Your definitions are correct, but in a different domain: you are using the mathematical definitions. What these functions give you is information about the representation of the numbers in memory, not information about the numbers themselves. For example, (integer? 1.0) will give you false. A

Re: [ANN] clj-kafka 0.3.1

2015-06-12 Thread Bruce Durling
Paul, This is great news. Looking forward to using it. cheers, Bruce On Fri, Jun 12, 2015 at 4:35 PM, Paul Ingles p...@oobaloo.co.uk wrote: Hi all, I'm delighted to say 0.3.1 is released and available on Clojars. It's been a long while since we've made any big changes to clj-kafka so I'm

Unable to get a response from my server, after re-architecting to get away from global vars

2015-06-12 Thread Lawrence Krubner
When I first wrote a Clojure web app, I followed a lot of the basic tutorials out there, and those tend to create a lot of global vars. So, for instance, I used the defroutes macro from Compojure, which left me with a global app-routes var. But lately I wanted to switch to a style that would

Re: defrecord, equality, hashing, and performance

2015-06-12 Thread Mars0i
On Friday, June 12, 2015 at 1:34:20 AM UTC-5, Andy Fingerhut wrote: deftype allows you to override hashCode and/or hasheq (I believe defaulting to identity-based implementations from java.lang.Object). defrecord does not. Sorry--I misread your earlier statement about this. That's good to

Re: defrecord, equality, hashing, and performance

2015-06-12 Thread Mars0i
Oh, yes, and that's an interesting idea to wrap a record in an atom or delay. For my present uses that would be more trouble than it's worth, but it's something worth keeping in mind for other situations. On Friday, June 12, 2015 at 10:41:57 AM UTC-5, Mars0i wrote: puzzler, thanks for the

[ANN] clj-kafka 0.3.1

2015-06-12 Thread Paul Ingles
Hi all, I'm delighted to say 0.3.1 is released and available on Clojars. It's been a long while since we've made any big changes to clj-kafka so I'm very happy to say we've caught up over the past couple of days. Most of the changes were the result of submissions from the community but I

Re: defrecord, equality, hashing, and performance

2015-06-12 Thread Mars0i
puzzler, thanks for the explanation about how you built on potemkin's map options. Probably not useful for my current application--easier to just work around deftype's limitations on an ad-hoc basis. But that takes some of the fun (convenience) out of Clojure (and unnecessarily, I feel, I

Re: [ANN] clj-kafka 0.3.1

2015-06-12 Thread Omri Hurvitz
Hi Paul. This looks great - I am looking forward to replace my hacked wrapper for the Java (and Scala...) API with this code. One question: if I have a zk consumer stream with auto.commit.enable set to false, how do I manually commit the changes? Thanks, Omri On Friday, June 12, 2015 at

Re: [ANN] clj-kafka 0.3.1

2015-06-12 Thread Ragnar Dahlén
Hi Omri, There's clj-kafka.zk/set-offset! for exactly that purpose: https://pingles.github.io/clj-kafka/clj-kafka.zk.html#var-set-offset.21 Thanks, Ragnar On Friday, 12 June 2015 18:23:23 UTC+1, Omri Hurvitz wrote: Hi Paul. This looks great - I am looking forward to replace my hacked

Re: defrecord, equality, hashing, and performance

2015-06-12 Thread Alex Miller
I bumped up the priority on CLJ-1224 to make sure it got pulled into 1.8 (based on being reminded about it here). I don't expect it to be included in 1.7. On Thursday, June 11, 2015 at 9:30:21 PM UTC-5, Mike Rodriguez wrote: I agree the hashCode performance for records is a concern due to

Re: [ANN] clj-kafka 0.3.1

2015-06-12 Thread Henrik Lundahl
Great stuff! Thanks Paul, Ragnar and others! -- Henrik On Fri, Jun 12, 2015 at 5:35 PM, Paul Ingles p...@oobaloo.co.uk wrote: Hi all, I'm delighted to say 0.3.1 is released and available on Clojars. It's been a long while since we've made any big changes to clj-kafka so I'm very happy