Re: Getting http-agent to throw an exception if url doesn't exist?

2011-01-29 Thread Max Weber
Give clj-http a try (https://github.com/getwoven/clj-http). It has an architecture similar to the one of Ring. Especially the Ring-style middleware helps a lot, if you want to add custom behaviour like error handling to clj-http. On 27 Jan., 02:21, Michael Ossareh wrote: > On Wed, Jan 26, 2011 at

How to disallow unlisted optional argument keys?

2011-01-29 Thread Shantanu Kumar
Hi, Given this example: (defn hello [& {:keys [a b]}] "hello") => (hello :foo "bar") ; :foo isn't listed! "hello" How can I disallow all keys except :a and :b in this example? Regards, Shantanu -- You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Getting started with Counterclockwise

2011-01-29 Thread Mike Meyer
"Laurent PETIT" wrote: >2011/1/20 Ken Wesson > >> On Wed, Jan 19, 2011 at 9:39 AM, Rayne >wrote: >> > Aren't you a developer? >> >> I'm not a CCW developer. >> >> > If a code.google link is the top of google results, that's what I'm >> > going to click and check out first. code.google is a proj

Re: How to disallow unlisted optional argument keys?

2011-01-29 Thread Robert McIntyre
you could do something like this, but I'm curious --- why do you want to restrict the function's inputs in this way? (defn hello [& {:keys [a b] :as input}] (assert (= (set (keys input)) #{:a :b})) "hello") sincerely, --Robert McIntyre On Sat, Jan 29, 2011 at 1:19 PM, Shantanu Kumar wrote: >

Re: How to disallow unlisted optional argument keys?

2011-01-29 Thread Shantanu Kumar
On Jan 30, 1:26 am, Robert McIntyre wrote: > you could do something like this, but I'm curious --- why do you want > to restrict the function's inputs in this way? As they are optional arguments, it's possible that somebody might misspell a key and spend time debugging. The intention is to avoid

Re: Getting started with Counterclockwise

2011-01-29 Thread Ken Wesson
On Sat, Jan 29, 2011 at 1:46 PM, Mike Meyer wrote: > Ditto.  Most often, the "code" site is the sole project site, and everything > is there. Some larger projects may have a separate "home" page, but it's > always prominently mentioned on the "code" site. In either case, the "code" > site is wo

Re: How to disallow unlisted optional argument keys?

2011-01-29 Thread Robert McIntyre
I see, so you wanted to allow some subset of the optional arguments. Might I recommend the following? Sets are already functions that check for inclusion of the objects on which you call them, so instead of (contains? some-set ele) just (some-set ele) will work. Also, upon actually making a typo

Re: How to disallow unlisted optional argument keys?

2011-01-29 Thread Shantanu Kumar
On Jan 30, 3:18 am, Robert McIntyre wrote: > I see, so you wanted to allow some subset of the optional arguments. > > Might I recommend the following? > Sets are already functions that check for inclusion of the objects on > which you call them, so instead of (contains? some-set ele) just > (som

def inside a function / set object null

2011-01-29 Thread David Steiner
Hi all, i stumbled upon this code, and am curious why it's not working: user> (defn makea [] (def a 232)) #'user/makea user> (makea) #'user/a user> a 232 user> (ns-unmap *ns* 'a) nil user> (makea) #'user/a user> a ---> Unable to resolve symbol: a in this context [Thrown class j

Re: How to disallow unlisted optional argument keys?

2011-01-29 Thread Ken Wesson
On Sat, Jan 29, 2011 at 5:18 PM, Robert McIntyre wrote: > I see, so you wanted to allow some subset of the optional arguments. > > Might I recommend the following? > Sets are already functions that check for inclusion of the objects on > which you call them, so instead of (contains? some-set ele)

Re: def inside a function / set object null

2011-01-29 Thread Ken Wesson
On Sat, Jan 29, 2011 at 5:42 PM, David Steiner wrote: > another question i had: is there a way to destroy java objects in clojure? > how do i set an object to null, so the garbage collector can do it's thing? You just discard all references to an object. Clojure's compiler does something called "