Re: REPL and Leiningen checkouts

2011-08-19 Thread J . Pablo Fernández
Thanks for the reply Chas. Does that mean that I have to create a Java project inside IntelliJ, instead of just opening the directory containing a Clojure/Lein project? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email

Re: REPL and Leiningen checkouts

2011-08-19 Thread Chas Emerick
A Maven project, yes. Just mounting a directory as a project and editing resources tells IntelliJ nothing about the projects in question. See: http://wiki.jetbrains.net/intellij/Creating_and_importing_Maven_projects#Importing_an_existing_Maven_project_into_an_IntelliJ_IDEA_project What I saw

Re: Video Slides on Pattern Matching and Predicate Dispatch in Clojure

2011-08-19 Thread Ken Wesson
On Thu, Aug 18, 2011 at 11:00 PM, Meikel Brandmeyer m...@kotka.de wrote: Eh, what exactly does slideshare provide over a PDF put on some server somewhere? Apparently, the ability to annoy the hell out of whoever you try to share it with. -- Protege: What is this seething mass of

Errors in Clojure

2011-08-19 Thread J . Pablo Fernández
Hello Clojurians, I'm struggling to work with errors in Clojure. This is one example, one case, but I had many like these before: user= (load-file /Users/pupeno/Projects/mgr/src/lobos/migrations.clj) org.postgresql.util.PSQLException: FATAL: role lobos does not exist (config.clj:1) It just

Re: Clojure-CLR, CLASSPATH, clojure.load.path and Cygwin

2011-08-19 Thread Ken Wesson
On Thu, Aug 18, 2011 at 11:05 PM, dmiller dmiller2...@gmail.com wrote: Several comments: (a) 'clojure.load.path' is not new in 1.3.  It's been in the code since at least May, 2009. (b) Regarding Dimitre's comment below, I probably did have Java system properties on my mind at the time.  I

Re: Errors in Clojure

2011-08-19 Thread Ambrose Bonnaire-Sergeant
Hi, The last thrown Exception/Error is kept in the var *e. You should be able to view the complete stack trace of the last thrown exception by calling something like: (.printStackTrace *e) Ambrose 2011/8/19 J. Pablo Fernández pup...@pupeno.com Hello Clojurians, I'm struggling to work with

Re: Video Slides on Pattern Matching and Predicate Dispatch in Clojure

2011-08-19 Thread Sam Aaron
Awesome talk - thanks! I particularly enjoyed the sign behind you that says Don't Panic! - it helped keep me calm during the hairily complex parts :-) I really look forward to seeing where you go with this stuff… Sam --- http://sam.aaron.name On 18 Aug 2011, at 21:10, David Nolen wrote:

Non-binary tree?

2011-08-19 Thread Ulrik Sandberg
I have data that I would like to represent as a non-binary tree, or perhaps a graph, but I'm not sure how to do that. The sample data looks like this: A-B B-C,D C-E D-E Here the number of subnodes from B are just two, but they may be any number, which is the source of my confusion. Binary trees

Re: Video Slides on Pattern Matching and Predicate Dispatch in Clojure

2011-08-19 Thread David Nolen
On Fri, Aug 19, 2011 at 3:57 AM, Ken Wesson kwess...@gmail.com wrote: On Thu, Aug 18, 2011 at 11:00 PM, Meikel Brandmeyer m...@kotka.de wrote: Eh, what exactly does slideshare provide over a PDF put on some server somewhere? Apparently, the ability to annoy the hell out of whoever you try

Re: Clojure-CLR, CLASSPATH, clojure.load.path and Cygwin

2011-08-19 Thread dmiller
I would be concerned about this group, if there was any evidence of existence. On Aug 19, 2:59 am, Ken Wesson kwess...@gmail.com wrote: And, maybe, the ones who have to go and reconfigure everything when they upgrade ... -- You received this message because you are subscribed to the Google

Re: Non-binary tree?

2011-08-19 Thread Justin Kramer
There are many ways one could model a tree/graph: ;; collection of edges [[:a :b] [:b :c] [:b :d] [:c :e] [:d :e]] ;; adjacency list {:a [:b] :b [:c :d] :c [:e] :d [:e]} If you're looking for a pre-made solution, the loom graph library (https://github.com/jkk/loom) may work: (ns example

Re: Non-binary tree?

2011-08-19 Thread Ulrik Sandberg
Thanks. That looks very interesting. ;; adjacency list {:a [:b] :b [:c :d] :c [:e] :d [:e]} For some reason, I have trouble constructing this recursively. I seem to always end up with something like this: user (build-tree :a :e) (:a (:b (:c (:e)) (:d (:e (defn build-tree [from to]

Re: ClojureQL Postgres question

2011-08-19 Thread Herwig Hochleitner
This is a bug in `rename`. That needs to be worked on, thanks for pointing it out. In the meantime, please use (- (table nil :users) (project [[:id :as :idx] :name]) to-sql) in the meantime. regards 2011/8/17 David Jagoe davidja...@gmail.com Hi All,

Re: Errors in Clojure

2011-08-19 Thread Petr Gladkikh
This is postgresql exception so problem is there (it's not Clojure's one). Just try to connect via some other tool to confirm this, use psql in command line, for example. Maybe there is missing group role that is linked to login role 'mgr'. PS: I hope that password is not a confidential one :)

Re: clojurescript support of ns-* functions

2011-08-19 Thread Chouser
On Thu, Aug 18, 2011 at 1:39 AM, Jim Blomo jim.bl...@gmail.com wrote: Hi, I'm enjoying playing with ClojureScript so far, great job guys! I'm wondering if functions like ns-aliases and Vars like *ns* will be implemented in future versions of ClojureScript.  If not, are there recommended

Re: Errors in Clojure

2011-08-19 Thread J . Pablo Fernández
Petr, I do not care about this particular error, but about how to deal with this one liners. Ambrose's reply is what I needed, and no, it's not PostgreSQL problem. It's a library trying to establish a connection when it shouldn't with credentials that should never be used because I never

Re: Non-binary tree?

2011-08-19 Thread Justin Kramer
I'm not sure if I'm addressing your needs exactly, but if you want to turn an adjacency list into a nested structure, here's one way: (def adj {:a [:b] :b [:c :d] :c [:e] :d [:e]}) (defn build-tree [adj from to] {:name from :children (when (not= from to) (map #(build-tree

Prisoner's Dilemma in Clojure

2011-08-19 Thread Christian Romney
Hi all, As part of my attempt to learn Clojure, I've cooked up a simple Prisoner's Dilemma simulation. I'd love any feedback the group would care to provide about my implementation, as I'm eager to improve. I've got thick skin so fire away! Annotated source: http://xmlblog.github.com/prisoners/

Re: Non-binary tree?

2011-08-19 Thread Ulrik Sandberg
Sorry for being unclear. I would in fact like to _create_ an adjacency list, given a start and end key, and the candidates function I mentioned. However, I have problems with coming up with a functional algorithm. I have a stateful one that works, but it's very ugly. (defn build-tree [from to m]

Re: Non-binary tree?

2011-08-19 Thread Benny Tsai
Probably a good idea for get-nodes to handle potential cycles: (defn get-nodes [from to] (loop [visited #{} [x xs] [from]] (if-not x visited (let [new-visited (conj visited x) neighbors (candidates x to) new-queue (remove new-visited (concat xs

Re: Non-binary tree?

2011-08-19 Thread Justin Kramer
Here's another way, which constructs a sequence of edges using candidates, which are then fed into reduce to build an adjacency list. (defn candidates-edges [candidates from to] (when-let [kids (seq (candidates from to))] (concat (for [k kids] [from k]) (mapcat #(get-edges

Re: Errors in Clojure

2011-08-19 Thread Chouser
2011/8/19 J. Pablo Fernández pup...@pupeno.com: Petr, I do not care about this particular error, but about how to deal with this one liners. Ambrose's reply is what I needed, and no, it's not PostgreSQL problem. It's a library trying to establish a connection when it shouldn't with credentials

Re: Non-binary tree?

2011-08-19 Thread Ulrik Sandberg
And get-edges? On 19 Aug, 20:52, Justin Kramer jkkra...@gmail.com wrote: Here's another way, which constructs a sequence of edges using candidates, which are then fed into reduce to build an adjacency list. (defn candidates-edges [candidates from to]   (when-let [kids (seq (candidates from

Re: Non-binary tree?

2011-08-19 Thread Justin Kramer
Oops, renamed the function: get-edges = candidates-edges. Justin On Friday, August 19, 2011 4:03:27 PM UTC-4, Ulrik Sandberg wrote: And get-edges? On 19 Aug, 20:52, Justin Kramer jkkr...@gmail.com wrote: Here's another way, which constructs a sequence of edges using candidates,

Re: Non-binary tree?

2011-08-19 Thread Ulrik Sandberg
It works great. Thanks a lot. I had a feeling concat and reduce were needed; I just couldn't figure out how. On 19 Aug, 22:10, Justin Kramer jkkra...@gmail.com wrote: Oops, renamed the function: get-edges = candidates-edges. Justin On Friday, August 19, 2011 4:03:27 PM UTC-4, Ulrik

Re: Non-binary tree?

2011-08-19 Thread Ulrik Sandberg
This works fine as well. More to digest. Thanks. On 19 Aug, 20:06, Benny Tsai benny.t...@gmail.com wrote: This is one way to do it functionally, though it's a bit more verbose. get-nodes performs a BFS walk of the tree between two nodes, returning the set of visited nodes: (defn get-nodes