Re: Calling .close() on resources -- with-open macro

2011-01-25 Thread Laurent PETIT
2011/1/25 Meikel Brandmeyer m...@kotka.de: Hi, On 25 Jan., 01:57, Laurent PETIT laurent.pe...@gmail.com wrote: (try (. ~(bindings 0) close) (catch Throwable _)) New code should use (.close foo) instead of (. foo close), IIRC. Sure, but it's an enhancement over existing code, so I've

Re: Calling .close() on resources -- with-open macro

2011-01-25 Thread Laurent PETIT
2011/1/25 Shantanu Kumar kumar.shant...@gmail.com: The changed code should catch 'Exception', not 'Throwable' because the latter is a common ancestor of both 'Exception' and 'Error'. An 'Error' must not be swallowed at any point in the system, unless you are writing an app server or a JVM

Re: Calling .close() on resources -- with-open macro

2011-01-25 Thread Shantanu Kumar
On Jan 25, 2:30 pm, Laurent PETIT laurent.pe...@gmail.com wrote: 2011/1/25 Shantanu Kumar kumar.shant...@gmail.com: The changed code should catch 'Exception', not 'Throwable' because the latter is a common ancestor of both 'Exception' and 'Error'. An 'Error' must not be swallowed at any

Re: Calling .close() on resources -- with-open macro

2011-01-25 Thread David Powell
On 25 Jan 2011 06:04, Shantanu Kumar kumar.shant...@gmail.com wrote: The changed code should catch 'Exception', not 'Throwable' because the latter is a common ancestor of both 'Exception' and 'Error'. An 'Error' must not be swallowed at any point in the system, unless you are writing an app

Re: Calling .close() on resources -- with-open macro

2011-01-25 Thread Shantanu Kumar
On Jan 25, 4:22 pm, David Powell djpow...@djpowell.net wrote: On 25 Jan 2011 06:04, Shantanu Kumar kumar.shant...@gmail.com wrote: The changed code should catch 'Exception', not 'Throwable' because the latter is a common ancestor of both 'Exception' and 'Error'. An 'Error' must not be

Re: Getting started with Counterclockwise

2011-01-25 Thread NovusTiro
Hello, Seems like this might be a good time to say thanks to Laurent for all the work he's done on CCW. FWIW, I've been using it for a while, and never had any issues installing it (at least not from a clean Eclipse), nor any of the other described issues. So thanks Laurent, and keep up the

Re: Why won't leiningen install for me?

2011-01-25 Thread Larry Travis
Mark, John, Gaz: Your responses are all suggestive but I don't know where to go from here so I am going to make one more cry for help -- and to this group rather than the leiningen-specific one suggested by Mark because my basic problem is really how-to-get-clojure/emacs-running-under-MacOsX.

Re: Calling .close() on resources -- with-open macro

2011-01-25 Thread David Powell
On Tue, Jan 25, 2011 at 1:04 PM, Shantanu Kumar kumar.shant...@gmail.comwrote: I can't see the value in catching Throwable and then re-throwing it; idiomatically Throwable is rarely caught. Looking at code example, the following two snippets below are just the same: (try (.close resource)

Re: Why won't leiningen install for me?

2011-01-25 Thread Sean Allen
I wiped my macports a while back, reinstalled everything I needed and stopped having problems like this. On Mon, Jan 24, 2011 at 9:38 PM, Mark Rathwell mark.rathw...@gmail.comwrote: Seems pretty clear that your macports version of curl is the problem, it's up to you what you want to do about

defrecord constructor woes

2011-01-25 Thread Mike
Quick question...I am trying to populate a record with values provided in a list. I'm definitely doing it the wrong way...but maybe there's no good way to do it. Here's what I do (clojure 1.2.0 by the way): (defrecord Foo [x y z]) (Foo. 1 2 3) #:user.Foo{:x 1, :y 2, :z 3} but then: (apply

Re: Calling .close() on resources -- with-open macro

2011-01-25 Thread Ken Wesson
On Tue, Jan 25, 2011 at 1:03 AM, Shantanu Kumar kumar.shant...@gmail.com wrote: The changed code should catch 'Exception', not 'Throwable' because the latter is a common ancestor of both 'Exception' and 'Error'. An 'Error' must not be swallowed at any point in the system, unless you are

Re: defrecord constructor woes

2011-01-25 Thread Mike
thanks!!! On Jan 25, 8:55 am, Meikel Brandmeyer m...@kotka.de wrote: Hi, constructors (like methods) are not first class. You have to wrap it in a factory function. (defn make-foo   [a b c d]   (Foo. a b c d)) (apply make-foo [1 2 3 4]) Sincerely Meikel -- You received this message

Re: Calling .close() on resources -- with-open macro

2011-01-25 Thread Meikel Brandmeyer
Hi, Disclaimer: I have no clue, what I'm talking about. Just making up contrived examples, which probably never happen in reality. On 25 Jan., 15:13, Ken Wesson kwess...@gmail.com wrote: Remember, we're no longer using a finally clause, so for the .close to be exception-safe *everything* must

Re: How does pmap partition its work?

2011-01-25 Thread Michael Gardner
I have run across something else I don't understand about pmap. Why does the following: (pmap (fn [_] (clojure.java.shell/sh sleep 10)) (range 32)) result in all 32 sleep processes being run at once? I thought pmap used n+2 threads, where n is the number of processors/cores available (I have

Re: How does pmap partition its work?

2011-01-25 Thread Ken Wesson
On Tue, Jan 25, 2011 at 9:45 AM, Michael Gardner gardne...@gmail.com wrote: I have run across something else I don't understand about pmap. Why does the following: (pmap (fn [_] (clojure.java.shell/sh sleep 10)) (range 32)) result in all 32 sleep processes being run at once? I thought pmap

Re: How does pmap partition its work?

2011-01-25 Thread Michael Gardner
On Jan 25, 2011, at 9:06 AM, Ken Wesson wrote: sh is asynchronous. It calls Runtime/exec, which launches the sleep as a separate process and immediately returns a Process object (which your pmap should be returning a seq of). It may produce n+2 Process objects at a time but it produces them

Re: How does pmap partition its work?

2011-01-25 Thread Ken Wesson
On Tue, Jan 25, 2011 at 10:21 AM, Michael Gardner gardne...@gmail.com wrote: On Jan 25, 2011, at 9:06 AM, Ken Wesson wrote: sh is asynchronous. It calls Runtime/exec, which launches the sleep as a separate process and immediately returns a Process object (which your pmap should be returning a

Re: How does pmap partition its work?

2011-01-25 Thread Michael Gardner
On Jan 25, 2011, at 9:33 AM, Ken Wesson wrote: Well, that's weird, because the documentation *I* read says it composits the arguments together into a command line and hands off to Runtime/exec. And the documentation of *that* says it returns a Process object and the process it launches runs

Re: Calling .close() on resources -- with-open macro

2011-01-25 Thread Shantanu Kumar
On Jan 25, 7:32 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, Disclaimer: I have no clue, what I'm talking about. Just making up contrived examples, which probably never happen in reality. On 25 Jan., 15:13, Ken Wesson kwess...@gmail.com wrote: Remember, we're no longer using a finally

Re: Why no def- ?

2011-01-25 Thread Benjamin Teuber
Ok, I think I've got it - so basically all private variants should go in contrib now and moving defn- now would break a lot of people's code just for a little more coherency. But in this case, I'd like def- to be included in clojure.contrib.def. I dislike defvar as it's just name and docstring

Re: How does pmap partition its work?

2011-01-25 Thread Andy Fingerhut
In my original message describing pmap's behavior, there was a little gotcha near the end: Note: Sometimes working at odds with pmap's Don't work too far ahead approach is if the input sequence to pmap is chunked. When a chunk is reached, all elements in that chunk have threads start in

Re: How does pmap partition its work?

2011-01-25 Thread Michael Gardner
On Jan 25, 2011, at 12:13 PM, Andy Fingerhut wrote: In my original message describing pmap's behavior, there was a little gotcha near the end: Note: Sometimes working at odds with pmap's Don't work too far ahead approach is if the input sequence to pmap is chunked. When a chunk is

ANN: Midje ready for production use (#testing #clojure.test)

2011-01-25 Thread Brian Marick
Midje is a testing framework that provides a migration path from clojure.test to a more flexible, readable, abstract, and gracious style of testing. I've bumped it to version 1. That means I feel safe offering it to you for production use. Here's a video showing how to migrate from

ANN: Sisyphus - mapreduce implemented in Clojure

2011-01-25 Thread Olek
Hi! It is nice to announce that Sisyphus - the google's mapreduce implemented in Clojure - has been released. Here are the sources: https://github.com/njoanna/Sisyphus Some comments are still in polish but they will be gradually replaced with english version. Right now there are 5 tasks

Re: Why won't leiningen install for me? (NOW IT DOES!)

2011-01-25 Thread Larry Travis
You guys are great! As my dad used to say when he had been greatly helped: Each of you is a scholar and a gentleman. I admire your expertise. You each had knowledgeable and quite helpful suggestions. I ended up using Alex's ideas for getting the Leiningen installation process to avoid

Re: ANN: Sisyphus - mapreduce implemented in Clojure

2011-01-25 Thread kovas boguta
Hi Olek, Could you explain how this differs from Hadoop in concept and in execution? Thanks. On Tue, Jan 25, 2011 at 2:26 PM, Olek aleksander.nas...@gmail.com wrote: Hi! It is nice to announce that Sisyphus - the google's mapreduce implemented in Clojure - has been released. Here are the

Conduit and LBQ

2011-01-25 Thread jim
Edmund Jackson has put up a blog post that describes how integrate LinkedBlockingQueue's with Conduit. It's a pretty good example of what you can do with Conduit without too much trouble. Jim http://boss-level.com/?p=89 -- You received this message because you are subscribed to the Google

Re: Why no def- ?

2011-01-25 Thread OGINO Masanori
Hello. If def- remains for historical reason, def- may be marked as duplicated and will be moved, for example, in 1.4, 2.0 or so? Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@gmail.com -- You received this message because you are subscribed to the Google Groups Clojure