Re: fitness

2009-03-05 Thread Matt Moriarity
what about memoizing the fitness function? call fitness on your structs, and if it's memoized, it will return the cached value as long as the struct is the same value. if it's changed, then it will recompute. somebody correct me if this doesn't account for something, but it sounds like the right a

Chrono date library

2009-03-05 Thread Matt Moriarity
This was posted about a little while ago, but a great deal more has happened. Basically, Phil Hagelberg and I have been working on a nice little date library for Clojure that doesn't rely on anything but the Java date APIs. Last time I posted about this, a few people brought up Joda time, which we

Re: def vs. intern

2009-01-28 Thread Matt Moriarity
yes, that is why. On Jan 27, 9:55 am, Mark Volkmann wrote: > On Mon, Jan 26, 2009 at 8:19 PM, James Reeves > > > > wrote: > > > On Jan 27, 2:08 am, Mark Volkmann wrote: > >> Let's see if I've got this straight. > > >> (def foo 1) creates a Var in the default namespace with a value of 1. > > >>

Re: pretty-printing?

2009-01-28 Thread Matt Moriarity
I say go for it. maybe swank could use it for macroexpansions and stuff. the lack of pretty-print drives me crazy! On Jan 27, 10:56 am, Mike DeLaurentis wrote: > Hi, > > Is anyone aware of a pretty-print function for Clojure? I saw there > was some discussion about it on this thread a while ago,

Re: namespace concept

2009-01-23 Thread Matt Moriarity
1) "use" and "require" differ in that use does what require does, loads a library, but it also refers to the symbols in that lib in the current namespace. So essentially if you want to use clojure.contrib.def/defvar, if you (require 'clojure.contrib.def), you would have to say (clojure.contrib.def

Re: Any way we can get this in clojure-contrib?

2009-01-22 Thread Matt Moriarity
a quick search, it looks like Mark McGranaghan is working on a > Clojure wrapper for Joda Time > herehttp://github.com/mmcgrana/clj-garden/tree/masterunder clj-time. > > On Thu, Jan 22, 2009 at 11:51 PM, Matt Moriarity > wrote: > > > > > By the way, I&#

Re: Any way we can get this in clojure-contrib?

2009-01-22 Thread Matt Moriarity
By the way, I'm in the process of sending in my contributor agreement. Just so you know :) --~--~-~--~~~---~--~~ 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

Any way we can get this in clojure-contrib?

2009-01-22 Thread Matt Moriarity
Under the suggestion of some people in the #clojure channel, I started working on a date library for Clojure since the built-in Java one is kind of a mess. It's not totally complete, but I think it could be quite useful. It supports getting the current date and time, and creating dates based on in

Re: Can Clojure functions be anonymous, curried and allow composition?

2008-11-24 Thread Matt Moriarity
comp composes functions just like the dot operator On Nov 24, 6:14 pm, dokondr <[EMAIL PROTECTED]> wrote: > On Nov 25, 2:06 am, Jarkko Oranen <[EMAIL PROTECTED]> wrote: > ... > > > > -- 3) Function composition: > > > Prelude> (f2 . f) 3 > > > 8 > > > Prelude> > > > 1) (def fn1 (partial + 1)) > >

Re: Can Clojure functions be anonymous, curried and allow composition?

2008-11-24 Thread Matt Moriarity
1 is actually an example of partial application of functions more than it is currying. Haskell's currying makes partial application far more natural though. In Clojure you can use the (partial ...) macro to do this: user=> (def f (partial + 1)) user=> (f 1) 2 2 is done using the (fn ...) special

Re: POLL: Domain name for project hosting site.

2008-11-17 Thread Matt Moriarity
my vote is for projecture or clojects --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL

Re: Newbie question: converting a sequence of map entries into a map

2008-10-28 Thread Matt Moriarity
what you're looking for i believe is into > (into {} (list [:a 2] [:b 3])) {:b 3, :a 2} On Oct 28, 3:05 pm, samppi <[EMAIL PROTECTED]> wrote: > I'm new at Clojure, but I'm really liking it, though. I'm having > trouble with using map on a map, and turning the resulting sequence of > map entries

Re: Evaluation of arguments in a macro

2008-10-27 Thread Matt Moriarity
ix my evaluation problem? On Oct 27, 6:00 pm, mb <[EMAIL PROTECTED]> wrote: > Hi, > > On 27 Okt., 21:08, Matt Moriarity <[EMAIL PROTECTED]> wrote: > > > > > I am trying to write a macro to rewrite something like this: > > >   (set-props my-jframe :t

Evaluation of arguments in a macro

2008-10-27 Thread Matt Moriarity
I am trying to write a macro to rewrite something like this: (set-props my-jframe :title "blah" :visible true) Into calls to the setter methods. I finally settled on this: (defmacro set-props [obj & props] (let [prop-map (apply hash-map props)] `(do ~(for [[key val] prop-