Re: Interface to integrate transactions with Clojure transactions

2010-06-11 Thread Chris Kent
Somebody on this list started an actual implementation of such an integration a couple of months ago. Try searching through the group's archive for terms like TransactionManager, or something very similar. Unfortunately my Java-fu is lacking enough for me not to remember the exact interface

introspecting types and records

2010-06-07 Thread Chris Kent
Hi Is there a way to introspect types defined with deftype and defrecord? I'd just like to know the field names and their order in the constructor. Java reflection works fine but requires some fiddling around to filter the static fields and __meta and __extmap. It feels like something that

Re: Class of a wicket page

2010-01-27 Thread Chris Kent
I think the problem is that cwicket.HomePage resolves to a class object (like cwicket.HomePage.class in Java).  So (class cwicket.HomePage) returns the class of the class object which is java.lang.Class.  And that's not a subclass of Wicket's WebPage.  Try this:   (defn -getHomePage [this]

Re: function to perform operations on adjacent values

2010-01-21 Thread Chris Kent
partition creates a sequence of sequences of adjacent values user= (partition 2 (range 1 7)) ((1 2) (3 4) (5 6)) and you can apply reduce to each of the sequences using map user= (map #(reduce + %) (partition 2 (range 1 7))) (3 7 11) or user= (map (partial reduce + ) (partition 2 (range 1

Re: Datatypes and protocols - update

2009-12-11 Thread Chris Kent
Rich Hickey richhickey at gmail.com writes: An updated version of the code for datatypes[1] and protocols[2] is now available in the 'new' branch[3]. I've converted some code that used gen-class to use deftype and defprotocol and the results are great so far. The code is shorter, easier to

Re: Datatypes and Protocols - early experience program

2009-11-13 Thread Chris Kent
Mark Engelberg mark.engelberg at gmail.com writes: I'm a little worried about the strong overlap between reify/proxy, deftype/defstruct, and defclass/gen-class. I can just imagine the questions a year from now when people join the Clojure community and want to understand how they differ. So

Re: dynamic :use

2009-09-08 Thread Chris Kent
James Sofra james.sofra at gmail.com writes: I know that this has come up before on the group and but is this not essentially dependency injection where the dependency being injected is a name space that presumably follows a particular convention in terms of what functions it provides?

Re: Keyword not serializable

2009-07-31 Thread Chris Kent
benefits, specifically that a proper patch would ensure that deserialized Keywords are interned as one would expect out. So, I may make a run at this sooner rather than later... - Chas On Jul 24, 7:06 pm, Chris Kent cjk...@gmail.com wrote: Hi Are there any fundamental reasons why

Re: REQUEST: Add seqable? to core

2009-07-29 Thread Chris Kent
I was thinking exactly the same thing. It feels like there should be a better way than instance? ...Sequable. Unless there's a reason that's a bad idea. Chris On Jul 27, 6:49 pm, Sean Devlin francoisdev...@gmail.com wrote: Rich, There have been a few times in this thread that people have

Keyword not serializable

2009-07-24 Thread Chris Kent
Hi Are there any fundamental reasons why the Keyword class shouldn't be serializable? I've been playing around with Clojure and Wicket and it's not possible to use maps containing Keywords in Wicket page classes. Wicket pages are serialized and stored in the session between requests and this

Re: surprising behaviour with do, ns and def

2009-07-14 Thread Chris Kent
the.stuart.sie...@gmail.com wrote: On Jul 13, 3:58 pm, Chris Kent cjk...@gmail.com wrote: user= (ns a) (def foo foo) a= #'a/foo a= If the same code is executed inside a do form the var is defined in the original namespace.  I thought that the do should make no difference.  Is this the intended

surprising behaviour with do, ns and def

2009-07-13 Thread Chris Kent
I've noticed that changing namespace with ns and then doing a def doesn't behave the same inside a do form: Without the do form it works as expected: user= (ns a) (def foo foo) nil a= #'a/foo a= If the same code is executed inside a do form the var is defined in the original namespace. I

find returns symbol keys without their metadata

2008-12-18 Thread Chris Kent
Hi I've been playing around using symbols with metadata as struct map keys after reading this message: http://groups.google.com/group/clojure/msg/68e7036dbd8ded29 It all works OK except when you use find to extract an entry. find returns an entry containing the key passed to it, not the key