Re: Allow Data Structure to Be Called as Function

2011-06-20 Thread Ryan Twitchell
Most notably, reify does not "def" anything. It's very in-tune with functional programming in that way, as it has no side-effects, whereas defrecord adds a class to the namespace. reify has been compared to Java's anonymous classes. A good example of its use might be in implementing a factory me

Re: Question about data structures and encapsulation

2011-06-16 Thread Ryan Twitchell
Regarding JavaBeans and the like, more often than not I've found that when getters and setters do not reference fields directly, they are contributing to a composition: as an adapter, a facade, or whatever- you-please. It is not quite as often that getters simply return a calculation based on data

Re: resultset-seq improvement: mapping column names

2010-12-01 Thread Ryan Twitchell
he columns, I suggest keeping the > following code handy: > > (defn stringify [m] >   (into {} (map (fn [k v] [(name k) v]))) > > The simply call map > > (map stringify results) > > Sean > > On Dec 1, 10:01 am, Ryan Twitchell wrote: > > > Hi all, > >

resultset-seq improvement: mapping column names

2010-12-01 Thread Ryan Twitchell
Hi all, I'm not too happy with how resultset-seq down-cases column names and turns them into keywords, as I would prefer to work with string keys in some cases. I came up with the following change to give the caller a choice to remap column keys in any way. This leaves resultset-seq's behavior f

defrecord and map equality?

2010-07-29 Thread Ryan Twitchell
Hi all, I noticed (with a very recent git pull) the following asymmetric behavior regarding = and records: (defrecord my-record [a]) (def r (new my-record 1)) (def s (new my-record 1)) (= r s);; true (= s r);; true (= r {:a 1}) ;; false (= {:a 1} r) ;; true Is this intentio

Re: java gui is flashing

2010-07-25 Thread Ryan Twitchell
HI, You'd be best served overriding the JPanel's paint or paintComponent method (I'm fuzzy on the difference), and then calling repaint periodically (at your desired frame rate). IIRC, repaint is safe to call from any thread, and it will cause the paint methods to be called in the swing thread.

Re: Finding vars from macros?

2010-07-20 Thread Ryan Twitchell
Thanks George, I'll definitely grab that from Clojars. Ryan -- 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 - please be patient with your fi

Re: Finding vars from macros?

2010-07-19 Thread Ryan Twitchell
Cloning from http://github.com/GeorgeJahad/debug-repl.git, I see the same behavior (but a different namespace). The (overloaded, no arg) expansion of the debug-repl macro returns a form by using a normal quote. The difference being between normal quote and syntax quote does mostly answer my quest

Finding vars from macros?

2010-07-19 Thread Ryan Twitchell
not at the repl. And instead of NO_SOURCE_FILE:58, it gave me my-file.clj:58 even though the line referred to is line 58 in the debug.clj file. Very confusing! Ryan Twitchell -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this