Re: Style preference: (:key map) or (map :key)?

2010-05-17 Thread Mike DeLaurentis
I don't know if it's more common or not, but I tend to use (:key map) most of the time, because it's a visual cue that I'm getting some key from a map. Whenever you see (:key something), you know that you're getting the :key field from something. When you see (something :key), you have to be more

Re: Testing equality

2010-04-28 Thread Mike DeLaurentis
Depending on what you're trying to do with paths, you may want to construct File objects and then get the paths from them. For example, (let [home (File. "/Users/Bill") bashrc (File . home ".bashrc")] (.getPath bashrc)) I think that tends to be less cumbersome than stringing path compo

Re: defn

2010-01-25 Thread Mike DeLaurentis
ith 1 argument, then the body of the function is: > > (factorial n 1) > > But if it is called with 2 arguments then the body of the function > is: > > (if (= n 0) acc > (recur (dec n) (* acc n))) > > Is this a standard feature of lisp? Sorry I am very noob

Re: defn

2010-01-25 Thread Mike DeLaurentis
That's defining a function factorial that can be called with either one or two arguments. When called with one argument, it immediately calls itself with two arguments. So the (factorial n 1) call provides acc with an initial value of 1. The ([n] and ([n acc] lines are the declarations of the pa

Re: Memfn: what does it mean?

2009-08-03 Thread Mike DeLaurentis
I believe it stands for "member function". From the doc string: "Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn." On Mon,

pretty-printing?

2009-01-27 Thread Mike DeLaurentis
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, but I don't seem to see anything related to pretty-print in either the core or clojure-contrib. If no one's working on implementing it, I might take a stab at it. Than

Compiling Clojure code with Maven

2008-12-31 Thread Mike DeLaurentis
I'm working on a project that has both Java and Clojure sources. We use Maven as our build system, and I'd like to use it to compile the Clojure sources. Has anyone done that before? I can think of a few ways to do it, such as using maven to run an ant task or writing a plugin, but I'm not sure wh

Re: Loading a resource file from the class path?

2008-12-20 Thread Mike DeLaurentis
I've never done that in Clojure, but another developer at the company I work for made a java utility that allows you to refer to classpath resources as URLs. It's on sourceforge in a package called "OpenHMS Common Utilities": http://openhms.sourceforge.net/common-util/ There's a class called com

Re: Bio

2008-11-11 Thread Mike DeLaurentis
That's great, thanks! On Mon, Nov 10, 2008 at 11:15 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > > On Nov 10, 9:38 pm, "Mike DeLaurentis" <[EMAIL PROTECTED]> wrote: >> Hi Rich, >> >> I'm giving a talk about Clojure tomorrow ni

Bio

2008-11-10 Thread Mike DeLaurentis
Hi Rich, I'm giving a talk about Clojure tomorrow night in Philadelphia for a functional programming user group, and I'd like to include some information about you. Do you have a standard bio you use for things like that? Just a few sentences about your background and your motivation for writing