Re: defrecord with inheritance

2012-05-22 Thread meb
Hey Luc, That's a cool casting strategy to cleanly build a standard way to get at the person piece of any type of applicable record. In the pure composition case, it's actually a nice solution to build functions know how to unpack the Person aspect of a subtype. However, I think which

Re: defrecord with inheritance

2012-05-21 Thread meb
I think it's misleading to use inheritance to reduce code duplication. Inheritance is about indicating function typing and creating typed contracts, both of which are fairly un-idiomatic in Clojure. However, there is another way to prevent code duplication: use composition instead. Instead

Re: accessing multiple return values

2012-01-03 Thread meb
I see two fairly straightforward paths to simulating multiple returns without breaking existing callers. Both take advantage of thread-local state and establish one convention for the caller: before calling the function again, every caller interested the extra return values must ask for these

Re: Override print-method of struct

2010-10-13 Thread meb
Instead of using a ref, you might consider using a closure, which seems a little more functional. So every child would simply store a function that when called would return the map of the parent, map you capture using a closure. This would also reduce your printing problems because functions

Re: inserting into vector

2010-08-26 Thread meb
(defn insert [v at el] (flatten (assoc v at [el (v at)])) You get a lazy seq back, so further operations are probably not as performant as they should be. But that would be as performant as a regular assoc for just that one operation. What you do from then on. Mark On Aug 26, 10:33 am,

Re: On retrieving auto-generated IDs after INSERT

2010-08-11 Thread meb
I have my own custom version where I bind the generated keys in the metadata of the returned seq. I think that's only valuable for clojure 1.2 though. The problem with returning an int is that many keys might be generated, though by the far the most common usage is simply an autoincrement column

Re: STM style disk persistance

2010-06-23 Thread meb
You might also want to check out Redis, which is supposed to act like disk persistent data structures in memory. The author just added a virtual memory module, so now Redis can handle datasets larger than the memory you assign it. Mark On Jun 22, 10:57 am, Timothy Baldridge tbaldri...@gmail.com

Re: leiningen - a Clojure build tool

2009-11-19 Thread meb
Was the name Leiningen inspired by the Esquire short story Leiningen vs. Ants? That would be a brilliantly obscure way to challenge the predominance of ant. Or did you have another reference in mind. Mark On Nov 18, 2:29 am, Phil Hagelberg p...@hagelb.org wrote: I'm pleased to announce the

Re: Package manager proposal

2009-08-07 Thread meb
I like the name Clojure Archive. On another note, I always wondered why xml was such a requirement for Java dependency management. Couldn't we design some sort of url schema, that you could just pass to a package importer in the program. First time you run, it could fetch the packages or

New Library for Berkeley DB

2009-08-02 Thread meb
Hey all, I couldn't find a good set of bindings that wrapped most of the BDB's features so I wrote my own. This library covers most of its basic feature, wrapping cursors, transactions, and key value functionality in more idiomatic clojure. You can check it out on