Re: What is the reason Lisp code is not written with closing parenthesis on new lines?

2010-08-29 Thread Tim Daly
You could do what one of my "modern language" (python) students did. Put the open parens at the end of the line and it looks like python! ( defun foo ( arg1 arg2 arg3 ) ( let ( tmp1 tmp2 ) ( firstFunction arg1 ) ( secondFunction arg2 ) ( thirdFunction arg3 ))) auggghhh! my eyes! my eyes!!!

Is there a construct-hash macro?

2010-08-29 Thread Nicolas Oury
Dear all, when you write a deftype and want to define a hashCode method, it would be really great to have access to a macro (construct-hash arg1 argn) that would compute the hash code of each arguments and combine them in a good way to produce a hash-code. Is there anything like that in co

Re: Is there a construct-hash macro?

2010-08-29 Thread Michał Marczyk
There's the undocumented clojure.core/hash-combine (wrapping a static method of clojure.lang.Util) which could perhaps be used for this purpose with reduce. It doesn't appear to be used anywhere, though -- I wonder about its current status...? At any rate, an officially supported (= documented) to

Re: What is the reason Lisp code is not written with closing parenthesis on new lines?

2010-08-29 Thread lprefontaine
My rough estimate is that more than 40 replies to that thread heave been generated up to now (I deleted the 28 ones without reading them after reading a couple of replies to the original post). Hmmm,,, I am about to think that we could have powered a small town with all that electrical nerve impul

Question about testing (and *load-tests*)

2010-08-29 Thread Sean Corfield
I'm sure this is just me being dumb about bindings but I've been writing tests and I saw in the docs it says you can cause deftest and with-test to not generate tests if you bind *load-tests* to false - for production. I can't quite get my head around how I would bind that variable in a way that a

Re: Question about testing (and *load-tests*)

2010-08-29 Thread Stuart Sierra
Hi Sean, As far as I know, that feature never saw much use. Most people like to keep their test and main sources separate, and build tools assume this. To bind *load-tests* during compilation, you would need to control your own build process. Basically, you would have to launch Clojure and execut

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-29 Thread Robert McIntyre
Has anyone actually implemented this sort of placeholder strategy before? --Robert McIntyre On Sat, Aug 28, 2010 at 3:04 PM, Michael Wood wrote: > On 28 August 2010 19:27, Michał Marczyk wrote: >> On 28 August 2010 19:19, Luke VanderHart wrote: >>> I'm not just talking about class hierarchy de

Re: where did I read that?

2010-08-29 Thread Robert McIntyre
That's a neat improvement to be able to ignore the value when you don't need it, thanks Michał Marczyk. Also, though both proxies happen to work with clojure's (read) function, every read operation of the pushback reader would have to be wrapped in the variable changing code to guarantee correctn

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-29 Thread Meikel Brandmeyer
Hi, Am 28.08.2010 um 19:09 schrieb Michał Marczyk: > I'm sure I'm missing lots of things, but I'd love to know which, so -- > please let me know. :-) In fact, your two-pass scenario is probably the best you can get, since you can define arbitrary classes in arbitrary namespaces. (Whether this i

Re: Question about testing (and *load-tests*)

2010-08-29 Thread Sean Corfield
Thanx Stuart. I had a feeling it might require that. I've mostly been using lein and keeping the tests separate but when I saw that in the docs I thought I'd try it because it would be kinda convenient inside CCW / Eclipse while developing. On Sunday, August 29, 2010, Stuart Sierra wrote: > Hi Se

Re: Question about testing (and *load-tests*)

2010-08-29 Thread Sean Corfield
So I thought I'd see if I could use tests in source code and add a hook to lein to bind *load-tests* to false around the compile but I'm missing something... Here's my hook: (ns leiningen.notests) (use 'robert.hooke) (defn no-tests [task & args] (binding [clojure.test/*load-tests* false]

Performance of ensure

2010-08-29 Thread ka
Hi, I have two refs a1, a2. One thread modifies a1, another modifies a2. Sample code: http://gist.github.com/556679 If I don't ensure any ref in the transaction, the code runs in ~ 0.2 ms. $ java -cp lib/clojure-1.2.0.jar\;src clojure.main -e "(require 'tt) (tt/transaction-simul {:ensure2 fals

Re: Extending Clojure's STM with external transactions

2010-08-29 Thread Alyssa Kwan
I'm resurrecting this thread from quite a while ago... I'm very interested in being able to ensure that the state of a ref is persisted as part of the same transaction that updates the ref. Performance is not important; correctness is. Has any further work been done on this front? http://groups.

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-29 Thread Robert McIntyre
I don't think two pases is enough. What if a clojure file uses reflection (with macros of course) on a compiled java file to generate classes, sort of like how lancet works but generating classes instead of functions? And then those classes are used from other clojure and java files. Oh, and the

Very slow compile on ext4

2010-08-29 Thread Florian Weimer
On an ext4 file system, building 04764db9b takes an awful lot of time: BUILD SUCCESSFUL Total time: 1 minute 38 seconds On a RAM disk on the same system, it's just: BUILD SUCCESSFUL Total time: 8 seconds This seems to be caused by excessive fsync() calls. Are those really necessary? Or do you

NullPointerExecption after Java class import

2010-08-29 Thread zm
I am using GATE java libs in my clojure code and behaviour of the application changes after Java class import. I don't even have to initialize it. This runs fine (a bit shorter version than it is): (ns gate (:import (gate Gate) (java.io File))) (defn gate-init [gate-home] (Gate

Re: Question about testing (and *load-tests*)

2010-08-29 Thread Phil Hagelberg
On Sun, Aug 29, 2010 at 5:27 PM, Sean Corfield wrote: > So I thought I'd see if I could use tests in source code and add a > hook to lein to bind *load-tests* to false around the compile but I'm > missing something... > > (defn no-tests [task & args] >  (binding [clojure.test/*load-tests* false] >

Re: NullPointerExecption after Java class import

2010-08-29 Thread Stuart Campbell
Hello, I don't know this library specifically, but the NPE is probably occurring in a static initialisation block. I believe static initialisation occurs when the class is first loaded. Regards, Stuart On 30 August 2010 06:42, zm wrote: > > I am using GATE java libs in my clojure code and beha