Re: SLIME REPL broken

2009-11-17 Thread Cyrus Harmon
Stefan put in words what I was thinking earlier today. For those of us that use both CL and clojure, keeping swank-clojure up to date wrt the slime HEAD is a good thing, if you ask me. It is, however, a two-way street and I would imagine that the swank-clojure implementors don't want to spend

Re: SLIME REPL broken

2009-11-17 Thread Stefan Kamphausen
Hi, Stefan Kamphausen wrote: I'll take a look at it the next few days (er, evenings that is), if I find the time. No promises ;-) Not that I'm close to a solution, but at least I have stacktrace... After some digging in the clojure-swank code I came across this piece in swank.clj: (defn-

A typo on the website about vars

2009-11-17 Thread Jacek Laskowski
Hi, I'm wondering what part is missing in which provides a means for nested contexts to communicate with code before it the call stack. at http://clojure.org/vars? I think the wording is broken at the end. Jacek -- Jacek Laskowski Notatnik Projektanta Java EE - http://www.JacekLaskowski.pl --

No names with trailing % allowed but with a leading one?

2009-11-17 Thread Stefan Kamphausen
Hi, during some examinations about the broken REPL with current Slime I found that I can't create names with a trailing %: Clojure 1.1.0-alpha-SNAPSHOT user= (def %thisworks 11) #'user/%thisworks user= %thisworks 11 user= (def %thisdoesnt% 22) java.lang.Exception: Too many arguments to def

Re: Clojure Web Libraries

2009-11-17 Thread Stuart Sierra
On Nov 16, 8:03 pm, ngocdaothanh ngocdaoth...@gmail.com wrote: Could someone provide an example about using Clojure with Restlet? I found:http://github.com/stuartsierra/altlaw-clojure-restlet but don't understand how the code works as a web application. It doesn't. That's just a few helper

Re: Datatypes and Protocols - early experience program

2009-11-17 Thread Stuart Sierra
On Nov 16, 11:57 am, Jonas Enlund jonas.enl...@gmail.com wrote: I made count return the number of rows because that way (count a-matrix) == (count (seq a-matrix)). I don't know if it's the right thing to do, maybe rows*cols would make more sense. Good point. I don't know which is better. -SS

Re: clojure.xml/parse of XHTML yields a 503 on the DTD

2009-11-17 Thread pkw
I'm having this same problem. Did you find a way around it? I want to try changing the User-Agent, but I can't figure out how to do that. What's a catalog file? any ideas? thanks, paul w -- You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: Remote REPL problem when connecting to RMI Client VM

2009-11-17 Thread Kent
Jon, Thanks for the reply. You are correct. When my compiled code tries to run (eval (+ 1 1)) I get the same exception that I got when I tried (+ 1 1) from the repl. Since I only need to be able to interact with the REPL when the client is running on my development machine, I am going to try

Re: Clojure Terracotta - TIM

2009-11-17 Thread Sergey Didenko
Hi Paul, the code from [1] does not work under the latest Terracotta (3.1.1) with clojure-slim.jar's in the following combinations: 1) branch 1.0.x from [3] 2) branch 1.0.x from [3] + modified ClojureTerracottaConfigurator.java (uncommented lines) 3) [2] svn revision 1335 + modified

Re: clojure.xml/parse of XHTML yields a 503 on the DTD

2009-11-17 Thread David Brown
On Tue, Nov 17, 2009 at 08:03:59AM -0800, pkw wrote: I'm having this same problem. Did you find a way around it? I want to try changing the User-Agent, but I can't figure out how to do that. I suspect that the Sax parser by default is configured to not allow fetching of the DTD over the net. I

Re: A typo on the website about vars

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 8:40 AM, Jacek Laskowski ja...@laskowski.net.plwrote: Hi, I'm wondering what part is missing in which provides a means for nested contexts to communicate with code before it the call stack. at http://clojure.org/vars? I think the wording is broken at the end.

Re: Datatypes and Protocols - early experience program

2009-11-17 Thread Sean Devlin
A quick aside about matrices. Every dense matrix algorithm is measured by the number of rows (n). LU factorization is O(n^3), as is QR. If memory serves, Eigenvalues are usually O(n^2). Determinants are O(n^3), too. These estimates change if the matrix is banded, they usually become O(n).

Re: No names with trailing % allowed but with a leading one?

2009-11-17 Thread Sean Devlin
I *THINK* what is meant by the non-numeric is anything that matches #[a-zA-z] Just my $.02 Sean On Nov 17, 9:30 am, Stefan Kamphausen ska2...@googlemail.com wrote: Hi, during some examinations about the broken REPL with current Slime I found that I can't create names with a trailing %:

Re: No names with trailing % allowed but with a leading one?

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 1:46 PM, Sean Devlin francoisdev...@gmail.comwrote: I *THINK* what is meant by the non-numeric is anything that matches #[a-zA-z] Nah, it'll be anything that's allowed elsewhere AND is not a digit. -- You received this message because you are subscribed to the

Re: No names with trailing % allowed but with a leading one?

2009-11-17 Thread Stefan Kamphausen
Hi, On Nov 17, 8:12 pm, John Harrop jharrop...@gmail.com wrote: On Tue, Nov 17, 2009 at 1:46 PM, Sean Devlin francoisdev...@gmail.comwrote: I *THINK* what is meant by the non-numeric is anything that matches #[a-zA-z] Nah, it'll be anything that's allowed elsewhere AND is not a digit.

Re: A typo on the website about vars

2009-11-17 Thread Chouser
On Tue, Nov 17, 2009 at 8:40 AM, Jacek Laskowski ja...@laskowski.net.pl wrote: I'm wondering what part is missing in which provides a means for nested contexts to communicate with code before it the call stack. at http://clojure.org/vars? I think the wording is broken at the end. Fixed,

Re: No names with trailing % allowed but with a leading one?

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 2:17 PM, Stefan Kamphausen ska2...@googlemail.comwrote: Hi, On Nov 17, 8:12 pm, John Harrop jharrop...@gmail.com wrote: On Tue, Nov 17, 2009 at 1:46 PM, Sean Devlin francoisdev...@gmail.com wrote: I *THINK* what is meant by the non-numeric is anything that

Re: SLIME REPL broken

2009-11-17 Thread Stefan Kamphausen
Hi, On Nov 17, 1:47 pm, Stefan Kamphausen ska2...@googlemail.com wrote: [...] user= user= Connection opened on local port  37693 #ServerSocket ServerSocket [addr=0.0.0.0/0.0.0.0,port=0,localport=37693] user= user= java.lang.InterruptedException [...]         at

Re: A typo on the website about vars

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 2:31 PM, Chouser chou...@gmail.com wrote: On Tue, Nov 17, 2009 at 8:40 AM, Jacek Laskowski ja...@laskowski.net.pl wrote: I'm wondering what part is missing in which provides a means for nested contexts to communicate with code before it the call stack. at

Re: A macro for flexible keyword argument handling

2009-11-17 Thread Constantine Vetoshev
On Nov 16, 4:28 pm, Chouser chou...@gmail.com wrote: 'let' is also careful to always have the user provide the symbol being bound as a symbol.  That is you say {:keys [a b c]} not {:keys [:a :b :c]}.  What do you think of having let-kw take symbols instead of keywords for the names being

Re: SLIME REPL broken

2009-11-17 Thread David Nolen
Stefan, Thanks for pursuing this so adamantly :) For a long time (more than a year) it was possible to use SLIME tip. It would be great for that to continue. David On Tue, Nov 17, 2009 at 2:44 PM, Stefan Kamphausen ska2...@googlemail.comwrote: Hi, On Nov 17, 1:47 pm, Stefan Kamphausen

Re: No names with trailing % allowed but with a leading one?

2009-11-17 Thread Stefan Kamphausen
Hi John, On Nov 17, 8:40 pm, John Harrop jharrop...@gmail.com wrote: The docs say that letters and *, +, !, -, _, and ? should work anywhere, do you read it that way? I think the doc (if you are referring to http://clojure.org/reader) are a little vague here: Symbols begin with a non-numeric

def a generated symbol?

2009-11-17 Thread nchubrich
How do you def a symbol that you make using (symbol)? I.E. if I try to do (def (symbol x) 2) I get: java.lang.Exception: Second argument to def must be a Symbol. (And why does it say the \second argument must be a symbol?) Thanks, Nick. -- You received this message because you are subscribed

Re: def a generated symbol?

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 3:59 PM, nchubrich nicholas.chubr...@gmail.comwrote: How do you def a symbol that you make using (symbol)? I.E. if I try to do (def (symbol x) 2) I get: java.lang.Exception: Second argument to def must be a Symbol. (And why does it say the \second argument must be a

Re: def a generated symbol?

2009-11-17 Thread Chouser
On Tue, Nov 17, 2009 at 4:11 PM, John Harrop jharrop...@gmail.com wrote: On Tue, Nov 17, 2009 at 3:59 PM, nchubrich nicholas.chubr...@gmail.com wrote: How do you def a symbol that you make using (symbol)?  I.E. if I try to do (def (symbol x) 2) I get: java.lang.Exception: Second argument to

Re: No names with trailing % allowed but with a leading one?

2009-11-17 Thread Meikel Brandmeyer
Hi, Am 17.11.2009 um 19:46 schrieb Sean Devlin: I *THINK* what is meant by the non-numeric is anything that matches #[a-zA-z] Along with !,+,*,.,?,... Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Proposal: Extend behavior of hash-map

2009-11-17 Thread Sean Devlin
Hey everyone, I was working with an object that implements java.util.Map today, and I had to turn it into a Clojure map. http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html I cam up with this utility fn (defn read-map Designed to turn a java.util.Map into a Clojure map. [a-map]

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Richard Newman
Sean, If the class implements Map, then it already behaves as an associative data structure in Clojure. E.g., (map (fn [[k v]] (println v)) (doto (java.util.HashMap.) (.put foo bar) (.put baz noo))) (get (doto (java.util.HashMap.) (.put foo bar) (.put baz

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Sean Devlin
Heh. Learn something new every day. This also works (into {} (System/getProperties)) On Nov 17, 4:56 pm, Richard Newman holyg...@gmail.com wrote: Sean, If the class implements Map, then it already behaves as an associative   data structure in Clojure. E.g., (map (fn [[k v]] (println v))

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Kevin Downey
user= (import 'java.util.HashMap) java.util.HashMap user= (def m (doto (HashMap.) (.put 'a :a) (.put 'b :b))) #'user/m user= m #HashMap {b=:b, a=:a} user= (into {} m) {b :b, a :a} user= (class *1) clojure.lang.PersistentArrayMap user= On Tue, Nov 17, 2009 at 1:56 PM, Richard Newman

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Richard Newman
Heh. Learn something new every day. Heh. Incidentally, because of this property there are only three situations in which you need conversion at all: * To get some additional interface that Clojure's maps provides (e.g., to use them as functions) * To get persistence * To have them print

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Alex Osborne
Sean Devlin wrote: Hey everyone, I was working with an object that implements java.util.Map today, and I had to turn it into a Clojure map. http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html I cam up with this utility fn (defn read-map Designed to turn a java.util.Map into a

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Sean Devlin
Wow. So this works user=(get (System/getProperties) os.arch) x86_64 And this does not user=((System/getProperties) os.arch) java.lang.ClassCastException: java.util.Properties cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0) but this does user=((into {} (System/getProperties)) os.arch)

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Sean Devlin
Okay golfers. Is there a better way to do this? (defn put-all! [java-map clj-map] (do (doseq [entry clj-map] (.put java-map (key entry) (val entry))) java-map)) user=(put-all (java.util.HashMap. ) {:a 1 :b 2 :c 3}) #HashMap {:c=3, :b=2, :a=1} I already tried into :)

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Alex Osborne
Sean Devlin wrote: Okay golfers. Is there a better way to do this? (defn put-all! [java-map clj-map] (do (doseq [entry clj-map] (.put java-map (key entry) (val entry))) java-map)) user=(put-all (java.util.HashMap. ) {:a 1 :b 2 :c 3}) #HashMap {:c=3, :b=2, :a=1}

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Mark Triggs
How about?: (java.util.HashMap. {:a 1 :b 2 :c 3}) = #HashMap {:c=3, :b=2, :a=1} Mark Sean Devlin francoisdev...@gmail.com writes: Okay golfers. Is there a better way to do this? (defn put-all! [java-map clj-map] (do (doseq [entry clj-map] (.put java-map (key

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Alex Osborne
Alex Osborne wrote: Sean Devlin wrote: Okay golfers. Is there a better way to do this? (defn put-all! [java-map clj-map] (do (doseq [entry clj-map] (.put java-map (key entry) (val entry))) java-map)) user=(put-all (java.util.HashMap. ) {:a 1 :b 2 :c 3}) #HashMap

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Sean Devlin
Very awesome. So this means you can (almost) use the putAll method. The only catch is putAll return void (WHY!) (defn put-all [java-map clj-map] (doto java-map (.putAll clj-map))) Sean On Nov 17, 5:29 pm, Alex Osborne a...@meshy.org wrote: Sean Devlin wrote: Okay golfers.  Is there

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Richard Newman
The only catch is putAll return void (WHY!) Apparently Java people like having more LOC :) (defn put-all [java-map clj-map] (doto java-map (.putAll clj-map))) Note that this isn't limited to Clojure maps, so 'clj-map' is probably a bad variable name. It works just as well for

Re: def a generated symbol?

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 4:22 PM, Chouser chou...@gmail.com wrote: On Tue, Nov 17, 2009 at 4:11 PM, John Harrop jharrop...@gmail.com wrote: On Tue, Nov 17, 2009 at 3:59 PM, nchubrich nicholas.chubr...@gmail.com wrote: How do you def a symbol that you make using (symbol)? I.E. if I try

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 5:06 PM, Sean Devlin francoisdev...@gmail.comwrote: Heh. Learn something new every day. This also works (into {} (System/getProperties)) And I'd much prefer it. Passing a mutable Java map around to functions that expect a map but assume it will never change out

Re: Deep deref

2009-11-17 Thread AndrewC.
In the example I made up Tina has the friend Karl. I can not simply store a copy of the Karl person in Tinas :friends slot, because when Karl gets one year older, then I don‘t want to go through all persons, looking for Karls, and have their age updated. Instead it is preferred to have

Re: Deep deref

2009-11-17 Thread AndrewC.
On Nov 15, 9:05 am, Danny Woods dannywo...@gmail.com wrote: Danny, could you maybe hack up a possible very simple example of what you mean? snip I can not simply store a copy of the Karl person in Tinas :friends slot, because when Karl gets one year older, then I don‘t want to go

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread Richard Newman
I wonder if perhaps (into {} a-java-map) should work but no other substitutions of a potentially-mutable map for a Clojure map. Baby, bathwater. Making a persistent map out of a Java map is expensive. Not everything that implements Map is concrete; e.g., spending several seconds making a

JScheme

2009-11-17 Thread Michael Jaaka
Can anyone defend Clojure in comparision to JScheme? I want to see all pros why to learn Clojure instead of JScheme. I've found out that the java methods invocation and rest of syntax is very similar, which satisfies me since it is easier to work with lisp family languages. -- You received this

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 6:24 PM, Richard Newman holyg...@gmail.com wrote: I wonder if perhaps (into {} a-java-map) should work but no other substitutions of a potentially-mutable map for a Clojure map. Baby, bathwater. Making a persistent map out of a Java map is expensive. Not everything

Re: Datatypes and Protocols - early experience program

2009-11-17 Thread harrison clarke
can anyone explain why this doesn't work? (defprotocol arrow ( ([f g] [f g fs]) compose left to right)) (extend clojure.lang.Fn arrow {: (fn ([f g] #(g (f %))) ([f g fs] (apply ( f g) fs)))}) ( inc inc inc) ; gives this error: ; java.lang.IllegalArgumentException:

Re: JScheme

2009-11-17 Thread Jeff Heon
Well, what are your needs or objectives? If you just want to do Scheme on top of Java, JScheme will be fine. The rationale behind Clojure is functional programming and concurrency: http://clojure.org/rationale For a more comprehensive answer, I'll let the man himself speaks 8) Rich does a

Re: A Clojure Highlife

2009-11-17 Thread Jeff Heon
On Nov 16, 2:49 pm, John Harrop jharrop...@gmail.com wrote: For a real challenge, try implementing Hashlife using Clojure's immutable data structures. :) This might help. http://www.ddj.com/hpc-high-performance-computing/184406478 To quote the author, Tomas G. Rokicki : This decision lets you

Re: JScheme

2009-11-17 Thread Fogus
My history man be wrong, but wasn't JScheme the original starting point for DotLisp? http://dotlisp.sourceforge.net/dotlisp.htm -m -- 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 Note that

Re: SLIME REPL broken

2009-11-17 Thread Constantine Vetoshev
On Nov 17, 2:52 pm, David Nolen dnolen.li...@gmail.com wrote: Thanks for pursuing this so adamantly :) For a long time (more than a year) it was possible to use SLIME tip. It would be great for that to continue. You can still use SLIME; just avoid the slime-autodoc contrib. Use (slime-setup

Re: def a generated symbol?

2009-11-17 Thread nchubrich
I always wondered what intern was for; the answer was staring me in the face On Nov 17, 9:08 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: On Nov 17, 5:57 pm, John Harrop jharrop...@gmail.com wrote: How stable is the intern function likely to be? Quite stable, I think.  It's a

Re: A macro for flexible keyword argument handling

2009-11-17 Thread nchubrich
Suppose one went for broke and made a variable binding form that was 1) Maximally permissive and 2) Notationally minimal Without saying whether this is \advisable, we might agree it would be an interesting exercise. It might look like this: \All arguments are potentially keywords; and since

Re: A macro for flexible keyword argument handling

2009-11-17 Thread nchubrich
(preceding message, re-formatted) Suppose one went for broke and made a variable binding form that was 1) Maximally permissive and 2) Notationally minimal Without saying whether this is \advisable, we might agree it would be an interesting exercise. It might look like this: \All

Re: SLIME REPL broken

2009-11-17 Thread Phil Hagelberg
Stefan Kamphausen ska2...@googlemail.com writes: Unless there are some really great features added upstream in slime, fixing swank-clojure to work with their latest changes is a low priority. this is a pity, at least for those of us, who also use Slime to do some CL hacking. For that setup

[ANN] leiningen - a Clojure build tool

2009-11-17 Thread Phil Hagelberg
I'm pleased to announce the initial release of Leiningen. Leiningen is a build tool for Clojure designed to not set your hair on fire. Building Clojure projects with tools designed for Java can be an exercise in frustration. If you use Ant, you end up copying around a lot of the same tasks

Re: [ANN] leiningen - a Clojure build tool

2009-11-17 Thread David Nolen
Awesomeness. On Wed, Nov 18, 2009 at 2:29 AM, Phil Hagelberg p...@hagelb.org wrote: I'm pleased to announce the initial release of Leiningen. Leiningen is a build tool for Clojure designed to not set your hair on fire. Building Clojure projects with tools designed for Java can be an