Re: Clojure Jobs in White Plains, NY

2010-02-07 Thread Michael Kohl
On Thu, Feb 4, 2010 at 10:29 PM, Eric Thorsen ethor...@enclojure.org wrote: ThorTech Solutions care...@thotech-solutions.com Is the missing 'r' in the mail address a kind of pre-selection of applicants? ;-) Michael -- You received this message because you are subscribed to the Google Groups

Re: Dutch Clojure users

2010-02-07 Thread Joop Kiefte
I'm closer to Utrecht (Ede) but the train reaches both places directly. And I work closer to Rotterdam. 2010/2/7 Jeff Rose ros...@gmail.com There is a group of us hacking Clojure in Amsterdam and Utrecht. Where are you? Join the Amsterdam Clojurians Google group, and we'll meet for a pizza.

Re: Dutch Clojure users

2010-02-07 Thread Hubert Iwaniuk
Great to hear that there is Clojure group around. For ease of finding it: http://groups.google.com/group/amsterdam-clojurians?hl=en Cheers, Hubert On Sun, Feb 7, 2010 at 4:37 AM, Jeff Rose ros...@gmail.com wrote: There is a group of us hacking Clojure in Amsterdam and Utrecht. Where are

Cartesian product of map pairs w/labels

2010-02-07 Thread Robert Campbell
Imagine a map m { foo [1 2 3 4] bar [\a \b \c] baz [true false] } How could I transform that into a seq s ( {foo 1 bar \a baz true} {foo 1 bar \a baz false} {foo 1 bar \b baz true} {foo 1 bar \b baz false} {foo 1 bar \c baz true} {foo 1 bar \c baz false} {foo 2 bar

Re: Cartesian product of map pairs w/labels

2010-02-07 Thread Michał Marczyk
On 7 February 2010 16:10, Robert Campbell rrc...@gmail.com wrote: Imagine a map m { [ snip ] } How could I transform that into a seq s ( [ snip ] ) To answer this part of the question: You could (use 'clojure.contrib.combinatorics) (for cartesian-product), then do (map #(interleave (keys

Re: Dutch Clojure users

2010-02-07 Thread Robert Campbell
I'm only 1.5hr flight away in Prague. I'd be happy to host any Clojure users to trade notes over our famous beer. On Sat, Feb 6, 2010 at 12:26 PM, Joop Kiefte iko...@gmail.com wrote: Hello folks! I am from the Netherlands and I am learning Clojure now, using it at work, and loving it so far.

Re: Cartesian product of map pairs w/labels

2010-02-07 Thread Michał Marczyk
Ouch, sorry, I misread your specs... Use this instead: (map #(zipmap (keys coordinates) %) (apply cartesian-product (vals coordinates))) With coordinates bound to your example map, this produces ({baz true, bar \a, foo 1} {baz false, bar \a, foo 1} ...) (which is your example output with

Re: Cartesian product of map pairs w/labels

2010-02-07 Thread Robert Campbell
Hi Michał, That works perfectly and is much simpler, thank you. On Sun, Feb 7, 2010 at 4:23 PM, Michał Marczyk michal.marc...@gmail.com wrote: Ouch, sorry, I misread your specs... Use this instead: (map #(zipmap (keys coordinates) %)  (apply cartesian-product (vals coordinates))) With

metadata and defn: why meta returns a non nil value on a function value ?

2010-02-07 Thread Ludovic Kuty
Hello everyone, I came upon a weird behaviour of Clojure. Weird as far as I understand what is going on with metadata. Maybe not very far. I understand that the reader macro #^ associates metadata with a form, for use by macros or the compiler as illustrated below. user= (defmacro m [form]

Re: Cartesian product of map pairs w/labels

2010-02-07 Thread Michał Marczyk
On 7 February 2010 16:28, Robert Campbell rrc...@gmail.com wrote: That works perfectly and is much simpler, thank you. Sure thing! As for your macro producing (), note that it never uses its argument in its body. What it does use instead is something called 'coordinates' -- my guess would be

Re: metadata and defn: why meta returns a non nil value on a function value ?

2010-02-07 Thread Michał Marczyk
My conjecture would be that the Var gets constructed and assigned its name in the current namespace first, then the function is constructed, then metadata gets attached to the Var. Thus the first defn pulls metadata to be attached to the newly constructed function from a newly constructed Var,

Re: metadata and defn: why meta returns a non nil value on a function value ?

2010-02-07 Thread Michał Marczyk
Oh, and of course the final line of the above REPL interaction is this: user (meta #'x) {:ns #Namespace user, :name x, :file NO_SOURCE_FILE, :line 1, :arglists ([])} Thus there's a sort of an off-by-one error in that the function created by defn gets the metadata which was attached to its Var

Inheriting from IDeref - good idea or bad practise?

2010-02-07 Thread James Reeves
Hi folks, Would those more knowledgable about Clojure care to weigh in on whether it be a good idea to create a custom class inheriting from IDeref? I've been considering creating session proxy objects (to be later replaced with protocols) that would respond to deref calls, e.g. (def session

Re: Inheriting from IDeref - good idea or bad practise?

2010-02-07 Thread Laurent PETIT
I don't know, but it seems like a bad smell that you can't find your joy by using the built-in state management constructs ( a bad smell in general, not saying on your side or on clojure side ) 2010/2/7 James Reeves weavejes...@googlemail.com: Hi folks, Would those more knowledgable about

Re: Inheriting from IDeref - good idea or bad practise?

2010-02-07 Thread James Reeves
On Feb 7, 4:06 pm, Laurent PETIT laurent.pe...@gmail.com wrote: I don't know, but it seems like a bad smell that you can't find your joy by using the built-in state management constructs The build-in state management constructs only deal with data in memory. I'm thinking deref could potentially

Re: Inheriting from IDeref - good idea or bad practise?

2010-02-07 Thread Allen Rohner
I can't comment on style, but I can say I successfully made a protocol to implement SoftReferences: (deftype SoftRefHolder [#^java.lang.ref.Reference ref] clojure.lang.IDeref (deref [] (.get ref))) (defn soft-reference returns a soft reference to x. Access using deref [x] (let

Re: Inheriting from IDeref - good idea or bad practise?

2010-02-07 Thread Stuart Halloway
IMO Anything that implements IDeref should adhere to Clojure's vision for identity, e.g. reads need to be thread safe, cheap, require no coordination, and block no one. Stu Hi folks, Would those more knowledgable about Clojure care to weigh in on whether it be a good idea to create a

Re: metadata and defn: why meta returns a non nil value on a function value ?

2010-02-07 Thread Michał Marczyk
On 7 February 2010 16:40, Ludovic Kuty ludovic.k...@gmail.com wrote: 1) When I call (meta f), I get something. I thought there can't be any metadata on a function value. But I see :ns and :name in the map. I completely forgot about the first point... Metadata on functions has been introduced

An off-by-one error in attaching metadata to functions defined with defn

2010-02-07 Thread Michał Marczyk
Apparently the fn objects constructed with defn will have attached to them the metadata which was attached to the Var named by the `name' symbol in the defn form *prior* to the evaluation of defn form -- or else the metadata of a freshly created Var when the Var did not exist previously. I think

Parallel version of list comprehension

2010-02-07 Thread Tim Snyder
Is there a straight-forward way to get parallelization when using list comprehension? The form of for syntax is much preferable to the closest I could come up with using pmap. I also was having trouble getting the correct level of nesting down when using pmap, though probably because I'm tired.

Re: metadata and defn: why meta returns a non nil value on a function value ?

2010-02-07 Thread Ludovic Kuty
Thanks for having shared your findings. I saw a post where Rich Hickey mentionned that he was planning to add metadata to functions but I didn't know it was already done from what I saw on the net. On Feb 8, 2:54 am, Michał Marczyk michal.marc...@gmail.com wrote: On 7 February 2010 16:40,

Clojure ad on StackOverflow.com

2010-02-07 Thread Baishampayan Ghose
Hi, This is an interesting attempt by the StackOverflow people to promote FOSS projects http://meta.stackoverflow.com/questions/31913/open-source-advertising sidebar-1h-2010/31972 (http://bit.ly/so-foss-ads) I think we should create a couple of Clojure ads and vote them up. Regards, BG --