Re: gen-class and namespace

2008-10-09 Thread mb
Hi, gen-class loads eg. foo/bar/Baz.clj for class foo.bar.Baz. However, maybe one also has support functions in the foo.bar namespace. Hence one needs also foo/bar/bar.clj. I seem to be able to solve the problem by putting this at the top of Baz.clj: (ns foo.bar (:use foo.bar)) That

Re: Support for destructuring in clojure/binding

2008-10-09 Thread Krukow
On Sep 22, 4:36 am, Stephen C. Gilardi [EMAIL PROTECTED] wrote: I was surprised that clojure/binding doesn't support destructuring bind: Clojure user= (def a) #'user/a user= (def b) #'user/b user= (binding [[a b] [1 2]] (+ a b)) Hello Stephen. I am not sure I understand. Your example

Re: First Release of Chimp available

2008-10-09 Thread mb
Hello, On 9 Okt., 02:41, Jonas Bengtsson [EMAIL PROTECTED] wrote: It almost works now, however something fishy is going on when it tries to launch screen from vim. I've done the following setting: Do you also use the VimClojure plugin? Chimp heavily relies on its syntax highlighting. Of course

Re: First Release of Chimp available

2008-10-09 Thread mb
Hello, On 9 Okt., 06:41, Mitch [EMAIL PROTECTED] wrote: I've been using chimp a little bit, and it works pretty well except for the \ef command. It gives me the following error: E119: Not enough arguments for function: SNR31_EvalFile Please report such issues! Otherwise they can't be fixed.

Re: Creating a n-length vector filled with zeroes?

2008-10-09 Thread CuppoJava
Thanks for your help. (vec (replicate 1 0)) is much better than what I had before. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com To

Help going from ruby blocks to clojure sequences.

2008-10-09 Thread CuppoJava
Hi, I'm trying to wrap my head around functional programming, and I'm having some trouble doing the following: Here's a small iterator function that I wrote, which calls a function on each element of a vector-of-vectors. (defn v2d-each ([v2d stRow endRow stCol endCol func] (doseq r (range

Re: regex literal syntax

2008-10-09 Thread Brian Watkins
Yes, dealing with multiple escaped escape sequences is a weak point of handling regexs. To really integrate them into the language, and that integration is essential to success, they must be typed straight into the code literally without baggage. As much as flexibility and simplicity, the easy

Re: Casting java arguments...

2008-10-09 Thread J. McConnell
On Thu, Oct 9, 2008 at 12:06 PM, Luc Prefontaine [EMAIL PROTECTED] wrote: I may look stupid but how do you cast Java arguments ? user= (doc cast) - clojure/cast ([c x]) Throws a ClassCastException if x is not a c, else returns x. nil So, (cast java.sql.Driver

Re: Casting java arguments...

2008-10-09 Thread Stephen C. Gilardi
On Oct 9, 2008, at 12:06 PM, Luc Prefontaine wrote: Hi everyone, I may look stupid but how do you cast Java arguments ? (java.sql.DriverManager/registerDriver (clojure.lang.RT/classForName com.mysql.jdbc.Driver)) java.lang.ClassCastException: java.lang.Class cannot be cast to

Re: regex literal syntax

2008-10-09 Thread Stephen C. Gilardi
On Oct 8, 2008, at 11:03 AM, Chouser wrote: Of course if this change is unacceptable, these proposed rules could be applied to a new dispatch macro. One option would be something like #r/foo/ that would allow your choice of delimiters to further reduce the need for back-slash quoting within

Re: regex literal syntax

2008-10-09 Thread Paul Barry
What about having #pattern work like is does now, and then having #/ pattern/ work similarly to Ruby, Python, Perl, etc. regular expression in that they not require double escaping of characters like '\'? So in other words: #/em(.*?)\/em/ instead of: #em(.*?)\\/em The advantage to

special variables and lazyness

2008-10-09 Thread Sacha
Here is a little test : (def *indent* 0) (defmacro with-indent [ body] `(binding [*indent* (+ *indent* 1)] [EMAIL PROTECTED])) = (with-indent (print *indent*) (lazy-cons *indent* (cons *indent* nil))) 1(0 0) I somehow expected to have the special variable value lexically bound at

Re: regex literal syntax

2008-10-09 Thread Chouser
On Thu, Oct 9, 2008 at 2:03 PM, Paul Barry [EMAIL PROTECTED] wrote: What about having #pattern work like is does now, and then having #/ pattern/ work similarly to Ruby, Python, Perl, etc. regular expression in that they not require double escaping of characters like '\'? So in other words:

Re: another variant of class weirdness

2008-10-09 Thread Rich Hickey
On Oct 9, 2:30 pm, Stuart Halloway [EMAIL PROTECTED] wrote: Here's another variant of the classes are not first class objects in Java problem: user= (new String) user= (new (Class/forName java.lang.String)) java.lang.IllegalArgumentException: Unable to resolve classname: [EMAIL

Re: two dimensional arrays

2008-10-09 Thread Mark H.
On Oct 8, 9:54 am, Martin DeMello [EMAIL PROTECTED] wrote: That was my first thought, but I was hoping there was a library for this already. It seems to be a surprisingly uncommon use case (not just in clojure, I've ended up implementing something like that in several languages) - I'd have

Re: NPE with binding [was: Repl over Socket, binding and threads]

2008-10-09 Thread ntupel
On Thu, 2008-10-09 at 22:06 +0200, ntupel wrote: After further investigation and experimentation with macros I finally managed to trigger a NullpointerException: user= (defmacro on-thread [env exp] `(doto (new Thread #(binding ~env (~exp))) (start))) Ignore me. That's like doing ((prn

Re: regex literal syntax

2008-10-09 Thread Rich Hickey
On Oct 9, 4:48 pm, Chouser [EMAIL PROTECTED] wrote: On Thu, Oct 9, 2008 at 3:09 PM, Rich Hickey [EMAIL PROTECTED] wrote: The question is, are people willing to deal with the breakage in the short term? I certainly am, but that may not mean much. :-) Nobody has spoken out against it yet

if small syntax change proposal

2008-10-09 Thread Dmitri P
Allow cond-like specification of expression pairs and allow odd number of expressions. Let odd expressions in last position serve as default return value. There will be no impact on previous reading/writing of if. Stolen from Paul Graham's Arc. (defmacro myif ([x] x) ([x y] (if x