Re: defmatch macro

2011-10-03 Thread Michael Jaaka
Cool, if only that macro could expand to function which detects in runtime if one of argument which being matched is seq or vec and call proper routine which is applying :seq or leaving matching expression as for random access. This is just higher level automation, it doesn't breake core

clojure.core.logic.core/match usage

2011-10-03 Thread Sunil S Nandihalli
Hello everybody, I was playing with core.match library and I notice the following behavior let [x {:a 1 :b 2 :c 10 :d 30}] (match [x] [({:a _ :b _ :c _ :d _} :only [:a :b :c :d])] :a-1 [({:a _ :b 2} :only [:a :b])] :a0 [{:a 1 :c _}] :a1

Re: clojure.core.logic.core/match usage

2011-10-03 Thread Sunil S Nandihalli
please excuse the mistake in the namespace in the subject line... it should have been clojure.core.match.core/match On Mon, Oct 3, 2011 at 3:57 PM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hello everybody, I was playing with core.match library and I notice the following behavior

Re: clojure.core.logic.core/match usage

2011-10-03 Thread Sunil S Nandihalli
If I remove the line [{:a 1 :c _}] :a1 it returns :a-1 .. So, I guess it means that the behavior is undefined if there are multiple matches. Sunil. On Mon, Oct 3, 2011 at 3:57 PM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hello everybody, I was playing with core.match library and

Re: producing Blub code and vv.

2011-10-03 Thread Nicolas
Hi, Well many will agree that if you can find a good solution to this problem this is going to be usefull. I tend to agree too. The question is maybe can you find a good solution? My response would be no. Let me explain: From a theoretical point of view you can always translate one turring

Re: clojure.core.logic.core/match usage

2011-10-03 Thread Bronsa
I *think* this is because when there are multiple matches, the most specialized matches and 1 is less generic than _ On Mon, Oct 3, 2011 at 12.39 PM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: If I remove the line [{:a 1 :c _}] :a1 it returns :a-1 .. So, I guess it means that the

Re: clojure.core.logic.core/match usage

2011-10-03 Thread David Nolen
It's a bug, thanks for the report, http://dev.clojure.org/jira/browse/MATCH-23 David On Mon, Oct 3, 2011 at 6:27 AM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hello everybody, I was playing with core.match library and I notice the following behavior let [x {:a 1 :b 2 :c 10 :d

Re: suggestion for clojure development

2011-10-03 Thread Stuart Halloway
On 10/02/2011 05:20 PM, Stuart Halloway wrote: I was referring to the aggregate contrib, not a curated subset (which I agree is a good idea). Maybe we should call the aggregated thing the Libraries Formerly Known as Contrib (LFKAC). Here's how I envision the distribution structure: Clojure

Re: Equality comparison in 1.3

2011-10-03 Thread Chris Perkins
core.clj currently contains two definitions of =, one of which is commented out. The active one has this docstring: Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner.

Re: producing Blub code and vv.

2011-10-03 Thread Hank
Thanks for writing, I think this here sums it up nicely: Maybe all of this is possible. After all an human can do it manually. I have a background in machine learning/artificial intelligence ... and yes I can see those things come in handy here. But I see it as more a research topic than

ClojureScript REPL Changes

2011-10-03 Thread Brenton
Several improvements have been made to the ClojureScript REPL. In ClojureScript, the method of printing output will be different for each evaluation environment. There is now a var named *print-fn* in cljs.core which will need to be explicitly set to a function that can print in the target

Re: Problem Running ClojureScript on OpenJDK

2011-10-03 Thread Brenton
If you have been having problems the ClojureScript and OpenJDK, please try the current master branch of ClojureScript. I would be interested to know what problems still remain, if any, after these changes. On Oct 2, 11:07 pm, db donald.bl...@gmail.com wrote: Here's what the patch looks like for

Re: ClojureScript REPL Changes

2011-10-03 Thread David Nolen
I've been playing with the changes for the past few days. Huge improvement. Thanks for all this! David On Mon, Oct 3, 2011 at 10:11 AM, Brenton bashw...@gmail.com wrote: Several improvements have been made to the ClojureScript REPL. In ClojureScript, the method of printing output will be

Re: strangeloop presentations

2011-10-03 Thread Andreas Liljeqvist
N!! 2011/10/2 Alex Miller a...@puredanger.com Phil's was a 3 hour workshop and was not recorded sorry. On Oct 2, 4:01 am, Andreas Liljeqvist bon...@gmail.com wrote: Actually I am mostly looking forward to Phil's Getting Cozy with Emacs. I am very disappointed that there aren't

Can't eval locals problem

2011-10-03 Thread Razvan Rotaru
Ok, so I'm stuck. If any of you more seasoned clojurians have a hint that could get me out, I will be forever gratefull to him/her: I'm trying execute a query against google app engine datastore, using appengine-magic, with the filter dynamically generated from a map. Here's the closest code I

Re: break-on-gaps - just curious if there is a more idiomatic way to do this

2011-10-03 Thread Thierry Pirot
qhfgva, 2011-09-28 20:39 +0200 I was wondering if there is a more clever/idiomatic way to solve this problem. (defn break-on-gaps [minutes] (reduce (fn [acc x] (if (empty? acc) [[x]] (if (= (inc (last (last acc))) x) (conj (vec (butlast

Re: Can't eval locals problem

2011-10-03 Thread Joop Kiefte
Try (defmacro order-query [params] `(ds/query :kind Order :filter (map #(list (key %) (val %)) ~params))) or (defmacro order-query [params] `(ds/query :kind Order :filter (map #(list (key %) (val %)) (eval ~params depending on the necessity of the eval (I suppose you don't really need the

Re: Can't eval locals problem

2011-10-03 Thread Stuart Halloway
Ok, so I'm stuck. If any of you more seasoned clojurians have a hint that could get me out, I will be forever gratefull to him/her: I'm trying execute a query against google app engine datastore, using appengine-magic, with the filter dynamically generated from a map. Here's the closest

Exception handling changes in Clojure 1.3.0

2011-10-03 Thread Constantine Vetoshev
I ran into an interesting problem while porting appengine-magic to Clojure 1.3.0. The Google App Engine SDK uses checked exceptions on many of its API methods. In many cases, I want to catch these exceptions and do something Clojure-friendly with them. With Clojure 1.2.x, I had no trouble

Re: Exception handling changes in Clojure 1.3.0

2011-10-03 Thread Stuart Halloway
The Google App Engine SDK uses checked exceptions on many of its API methods. In many cases, I want to catch these exceptions and do something Clojure-friendly with them. With Clojure 1.2.x, I had no trouble catching checked exceptions by type, e.g.: (try

Re: Exception handling changes in Clojure 1.3.0

2011-10-03 Thread Kevin Downey
Reflector.java wraps checked exceptions in runtime exceptions On Mon, Oct 3, 2011 at 12:27 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: The Google App Engine SDK uses checked exceptions on many of its API methods. In many cases, I want to catch these exceptions and do something

Re: Can't eval locals problem

2011-10-03 Thread Michał Marczyk
eval does work at macro expansion time, but only where it is actually possible to evaluate the expression its given with only the information available at macro expansion time at hand. One case where there is not enough information -- and a minimal Can't eval locals example -- is the following:

Re: Exception handling changes in Clojure 1.3.0

2011-10-03 Thread Paul Mooser
I believe the actual problem comes from things like RT.classForName(), which internally catches a ClassNotFoundException, and then does this: throw Util.runtimeException(e); That ends up just sort of obscuring what the exception is, and you can't just catch ClassNotFoundException

Re: ANN: tools.trace 0.7.1

2011-10-03 Thread Rob Wolfe
Luc Prefontaine lprefonta...@softaddicts.ca writes: [...] Just add: [org.clojure/tools.trace 0.7.1] to your dependency list in your project.clj. This should be a straight replacement for clojure.contrib.trace in your code. If you find suggestions/improvements it's time to let me know

Re: Can't eval locals problem

2011-10-03 Thread Michał Marczyk
Ok, so I mailed off the above discussion without including any suggestions for alternative approaches... *fail* Anyway, I think Joop's answer (especially the first code snippet) is *very* likely to be the best. As far as I can tell from reading the source, appengine-magic's query macro includes

Re: Exception handling changes in Clojure 1.3.0

2011-10-03 Thread Sean Corfield
On Mon, Oct 3, 2011 at 12:03 PM, Constantine Vetoshev gepar...@gmail.com wrote: This stopped working in 1.3.0. The caught exception does not match EntityNotFoundException; it is now a RuntimeException with the original typed exception chained to it. This caused me some pain in

Re: docs for 1.3

2011-10-03 Thread Sergey Didenko
My last mail remain unnoticed, so I'll clarify the question: Clearly (the main) clojure.org is not the main documentation source for 1.3. To prove it - try to find the mention of Factory function taking a map, e.g. map-MyRecord there. So what is the best search strategy right now to find the

Re: docs for 1.3

2011-10-03 Thread Sean Corfield
On Mon, Oct 3, 2011 at 2:05 PM, Sergey Didenko sergey.dide...@gmail.com wrote: Clearly (the main) clojure.org is not the main documentation source for 1.3. To prove it - try to find the mention of Factory function taking a map, e.g. map-MyRecord there. The defrecord improvements seem to be

Re: ANN: tools.trace 0.7.1

2011-10-03 Thread Luc Prefontaine
Oups, this one slipped.. I'll fix in the README now... On Mon, 03 Oct 2011 22:46:42 +0200 Rob Wolfe r...@smsnet.pl wrote: Luc Prefontaine lprefonta...@softaddicts.ca writes: [...] Just add: [org.clojure/tools.trace 0.7.1] to your dependency list in your project.clj. This

Re: ANN: tools.trace 0.7.1

2011-10-03 Thread Luc Prefontaine
Done... no need to re-publish yet. Thanx Luc On Mon, 3 Oct 2011 19:04:58 -0400 Luc Prefontaine lprefonta...@softaddicts.ca wrote: Oups, this one slipped.. I'll fix in the README now... On Mon, 03 Oct 2011 22:46:42 +0200 Rob Wolfe r...@smsnet.pl wrote: Luc Prefontaine

Re: Exception handling changes in Clojure 1.3.0

2011-10-03 Thread Constantine Vetoshev
On Oct 3, 12:27 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: Catching checked exceptions seems to work fine. Try e.g. (try (throw (java.io.IOException.)) (catch java.io.IOException _ caught!)) I suspect something else is going wrong in the GAE example. Can you narrow the code down to

Waiting for swank-clojure to be ready.

2011-10-03 Thread Nicolas Buduroi
Hi, I'm currently redoing my Clojure setup and I wonder how to make Emacs wait for swank-clojure to be ready before calling slime-connect. I've added a shortcut to start swank-clojure: (global-set-key [f8] '(lambda () (interactive) (start-process swank-clojure

Re: Waiting for swank-clojure to be ready.

2011-10-03 Thread Phil Hagelberg
On Mon, Oct 3, 2011 at 5:12 PM, Nicolas Buduroi nbudu...@gmail.com wrote: Hi, I'm currently redoing my Clojure setup and I wonder how to make Emacs wait for swank-clojure to be ready before calling slime-connect. You can use M-x clojure-jack-in, but that only works for Leiningen projects out of

Re: Waiting for swank-clojure to be ready.

2011-10-03 Thread Nicolas Buduroi
Thanks, this was really helpful. Here's what my shortcut looks like now: (global-set-key [f8] '(lambda () (interactive) (start-process swank-clojure *swank-clojure* ~/.lein/bin/swank-clojure) (set-process-filter (get-buffer-process *swank-clojure*)

Re: Problem Running ClojureScript on OpenJDK

2011-10-03 Thread db
Works for me. Thanks. On Oct 3, 10:15 am, Brenton bashw...@gmail.com wrote: If you have been having problems the ClojureScript and OpenJDK, please try the current master branch of ClojureScript. I would be interested to know what problems still remain, if any, after these changes. On Oct