Re: Formatted printing?

2008-10-11 Thread Paul Stadig
I'm using a clojure source file as a database, by loading the file modifying it then saving it back to the filesystem. I'm trying to keep things simple. It would be useful to pretty print it so I could inspect it and make small changes, if necessary. It seems like a rather simple problem, and I

Re: Get thread local bindings

2008-10-11 Thread ntupel
On Fri, 2008-10-10 at 12:46 -0700, Mike Hinchey wrote: > It's usually advised to avoid eval. Many thanks Mike. I would like to avoid eval, but I am too stupid. However I would love to find out how to do it. If you could give me hunch I would be more than happy. > See dothread-keeping in > http:

#' use in clojure-contrib macros

2008-10-11 Thread Meikel Brandmeyer
Hi, I also ran in the problem with #' in a macro with clojure-contrib. The attached patch changes all macros in clojure-contrib to the suggested way with (var). Sincerely Meikel var-vs-reader.patch Description: Binary data smime.p7s Description: S/MIME cryptographic signature

Re: Formatted printing?

2008-10-11 Thread Rich Hickey
On Oct 11, 8:54 am, "Paul Stadig" <[EMAIL PROTECTED]> wrote: > I'm using a clojure source file as a database, by loading the file > modifying it then saving it back to the filesystem. I'm trying to keep > things simple. > > It would be useful to pretty print it so I could inspect it and make > s

Re: #' use in clojure-contrib macros

2008-10-11 Thread Rich Hickey
On Oct 11, 9:26 am, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi, > > I also ran in the problem with #' in a macro with clojure-contrib. > The attached patch changes all macros in clojure-contrib to the > suggested way with (var). > Did you have a problem after rev 1059? I'm in the middle

Re: Metadata on defmulti

2008-10-11 Thread Rich Hickey
On Oct 11, 2:33 am, Jeff V <[EMAIL PROTECTED]> wrote: > Do multimethods support doc strings or other metadata? defmulti had been replacing any metadata on the name with a type hint. I've changed it (SVN rev 1060) so that it adds to any metadata on the name. So, for now, defmulti doesn't have the

Re: Clojure, emacs, slime, swank tutorial for Ubuntu

2008-10-11 Thread Aaron Bedra
rlwrap seems to be a much better solution. I do use emacs as my daily driver, but it's nice to have a backup on the command line. I wrote a getting started article for Ubuntu a while back if you want to check it out. http://aaronbedra.com/2008/8/17/adventures-in-clojure-getting-started I made

Re: Event Listeners in Functional Programming

2008-10-11 Thread CuppoJava
Yeah, Clojure provides all that I need for GUI programming. I was just wondering if there's an elegant way of doing GUI in a pure- functional way, without mutability. On Oct 10, 7:58 pm, Chouser <[EMAIL PROTECTED]> wrote: > On Fri, Oct 10, 2008 at 8:14 PM, CuppoJava <[EMAIL PROTECTED]> wrote: > >

Re: #' use in clojure-contrib macros

2008-10-11 Thread Meikel Brandmeyer
Hi, Did you have a problem after rev 1059? I'm in the middle of making some reader changes - if rev 1059 works then I recommend leaving your code alone until I am done. At that point, I will know if I am going to change the promise of #'x becomes (var x), and let everyone know. Checked. The pr

BUG: resultset-seq breaks on duplicate column names

2008-10-11 Thread Allen Rohner
If you create a SQL query that returns duplicate names, resultset-seq throws an exception: "java.lang.RuntimeException: java.lang.IllegalArgumentException: Too many arguments to struct constructor" i.e. (let [rs (query "select description,description from table")] (resultset-seq rs) The foll

REPL does not print stack trace in some cases

2008-10-11 Thread Allen Rohner
If you exercise the bug in my previous post about resultset-seq, the repl will not print a stack trace, it will only print the name of the exception and the message. The following patch modifies the repl to print the stack trace. Allen Index: src/jvm/clojure/lang/Repl.java =

What Windows IDE are you using?

2008-10-11 Thread CuppoJava
Hi guys, If anyone is using Windows, please share what environment you're using to program in. Currently I'm using Enclojure for Netbeans, but it's still new and a few features are broken. All I need is an IDE with: -method/parameter lookup (for clojure and java code) -syntax highlighting T

Clojure Repl forcing lazy lists?

2008-10-11 Thread R. P. Dillon
I was noticing that a lazy list seems to get forced as soon as you create it on the Repl because printing it forces evaluation. (range 1 100), for example, produces: (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

Re: REPL does not print stack trace in some cases

2008-10-11 Thread Chouser
On Sat, Oct 11, 2008 at 1:26 PM, Allen Rohner <[EMAIL PROTECTED]> wrote: > > If you exercise the bug in my previous post about resultset-seq, the > repl will not print a stack trace, it will only print the name of the > exception and the message. That's a feature! I recent one, no less. Serious

Re: REPL does not print stack trace in some cases

2008-10-11 Thread Allen Rohner
It's odd to me that that the stack traces were only removed in a few instances. There are still plenty of places that do print traces. I'm all in favor of getting rid of the "meaningless" stack traces, once we have better error reporting. Allen On Oct 11, 2:36 pm, Chouser <[EMAIL PROTECTED]> wr

Re: Clojure Repl forcing lazy lists?

2008-10-11 Thread Rich Hickey
On Sat, Oct 11, 2008 at 2:40 PM, R. P. Dillon <[EMAIL PROTECTED]> wrote: > > I was noticing that a lazy list seems to get forced as soon as you > create it on the Repl because printing it forces evaluation. (range 1 > 100), for example, produces: > > (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Re: REPL does not print stack trace in some cases

2008-10-11 Thread Chouser
On Sat, Oct 11, 2008 at 3:50 PM, Allen Rohner <[EMAIL PROTECTED]> wrote: > > It's odd to me that that the stack traces were only removed in a few > instances. There are still plenty of places that do print traces. Such as where? I haven't seen any at the repl in a while. If a .clj file loaded f

Re: REPL does not print stack trace in some cases

2008-10-11 Thread Jim Menard
On Sat, Oct 11, 2008 at 6:14 PM, Chouser <[EMAIL PROTECTED]> wrote: > > On Sat, Oct 11, 2008 at 3:50 PM, Allen Rohner <[EMAIL PROTECTED]> wrote: >> >> It's odd to me that that the stack traces were only removed in a few >> instances. There are still plenty of places that do print traces. > > Such

A workaround for thread-local binding.

2008-10-11 Thread CuppoJava
Hi, I'm trying to do the following in Clojure, and I'm wondering if there's a better way... This creates a little window, with a button that prints "my env" whenever it is clicked. (ns main (:import (javax.swing JFrame JButton) (java.awt.event ActionListener))) (def env) (defn main [ar

TransactionalHashMap

2008-10-11 Thread Mark McGranaghan
I was just wondering what the intended use is for TransactionalHashMap. Its a Java class defined in the Clojure source, but not used anywhere else in the core code. How does this class fit in with Clojure's PersistentHashMap and Java's ConcurrentHashMap? - Mark --~--~-~--~~--

Re: TransactionalHashMap

2008-10-11 Thread Chouser
On Sat, Oct 11, 2008 at 9:50 PM, Mark McGranaghan <[EMAIL PROTECTED]> wrote: > > I was just wondering what the intended use is for > TransactionalHashMap. Its a Java class defined in the Clojure source, > but not used anywhere else in the core code. How does this class fit > in with Clojure's Per

Re: two dimensional arrays

2008-10-11 Thread Mark H.
On Oct 10, 10:56 am, Martin DeMello <[EMAIL PROTECTED]> wrote: > On Oct 9, 12:29 pm, "Mark H." <[EMAIL PROTECTED]> wrote: > > > a mapping.  However, if you find yourself doing this a lot, you might > > want to think about a more Clojure-like idiom that doesn't require > > destructive updates and m

Re: two dimensional arrays

2008-10-11 Thread Mark H.
On Oct 11, 10:23 pm, "Mark H." <[EMAIL PROTECTED]> wrote: > Some people might want to take slices of matrices -- e.g., the following > (in Matlab notation): > > A( 1:2:end, 1:3:end ) > > which is a matrix containing every second row and every third column > of A.   Speaking of which, what's the r