Re: tests involving threads

2009-07-06 Thread Timothy Pratley

Thanks for the reply Jarkko,

Yes I can work around it. The scenario is that I want to see a message
correctly passed:
http://github.com/timothypratley/strive/blob/cef5a3a9ea18159f866fe6c94603b704daba1ba8/clj/timothypratley/test-messenger.clj
It is useful (tempting?) in this case to be able to check something on
a thread, but I can save the value and check it later to avoid doing
so.

Regarding futures not raising exceptions, this is actually completely
independent of test. From experimentation, exceptions on futures are
only reported if the future is @ examined (presumably by design). So I
think my options are to wrap long running futures in a try/catch/
report or use a normal Thread.


Regards
Tim.

On Jul 6, 7:52 pm, Jarkko Oranen  wrote:
> On Jul 6, 7:51 am, Timothy Pratley  wrote:
>
>
>
> > Very glad that test is now part of clojure core.
>
> > I've run into 2 strange behaviours when trying to write tests where
> > threads are involved. My case is a little complex so here is a minimal
> > version which shows what I mean:
>
> > test-test.clj:
> > (ns test-test
> >   (:use clojure.test))
>
> > (deftest testathon
> >   (let [f1 (future (is (= 1 2)))
> >         f2 (future (future (/ 1 0)))]
> >     @f1
> >     @f2))
>
> > (run-tests)
> > (shutdown-agents)
>
> > $ clj test-test.clj
>
> > Testing test-test
>
> > FAIL in clojure.lang.persistentlist$emptyl...@1 (test-test.clj:5)
> > expected: (= 1 2)
> >   actual: (not (= 1 2))
>
> > Ran 1 tests containing 0 assertions.
> > 0 failures, 0 errors.
>
> > f1 failed, and a FAIL message is printed, but the end report indicates
> > 0 failures.
> > f2 raised an exception silently.
>
> > I guess I'm just not "doing it right"!
>
> Are you sure you don't want to test something like
> (let [v (future (+ 1 2))]
>   (is (= @v 3)))
> instead? My guess is that having 'is inside a future messes up the per-
> thread bindings that clojure.test uses. I don't know if there's a way
> around that, but also doubt assertions inside futures are really
> useful.
>
> > Regards,
> > Tim.
>
> --
> Jarkko
--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Penumbra, a new set of OpenGL bindings

2009-07-06 Thread Glen Stampoultzis
2009/7/1 ztellman 

>
> Most of the OpenGL code I've seen has been a fairly literal
> translation of the corresponding Java, so as a way of getting my feet
> wet in Clojure I've written something that tries to be a little more
> idiomatic.  It can be found at
> http://github.com/ztellman/penumbra/tree/master
>
> The only really novel thing it brings to the table is intra-primitive
> transformations, which means that you can update the transformation
> matrix while defining a shape.  It's always bothered me that OpenGL
> doesn't allow this, so I added an additional transform step before
> passing the coords to glVertex.  This can be bypassed, but if you use
> call lists it doesn't affect your performance at all.
>
> If anyone has any questions or thoughts, I'd be happy to hear them.
>
>
Looks very nice.  I was just wondering what the license is.  I didn't see
anything on the site.

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: procedural docstring attachment

2009-07-06 Thread Richard Newman

> I have a function that relies on a keyword being supplied. The keyword
> is used to find something in a static map. I want to put in the doc-
> string:
> (str "blah blah blah, arg1 must be one of " (keys map))
> Suggestions?


You'd need to generate a suitable function definition using a macro.

E.g.,

(defmacro def-my-map-fun [name m]
   `(defn ~name
  ~(str "arg1 must be one of " (keys m))
  [~'arg1]
  (println ~'arg1 ~m)))


user=> (def-my-map-fun foobar {:foo :bar})
#'user/foobar

user=> (doc foobar)
-
user/foobar
([arg1])
   arg1 must be one of (:foo)
nil

user=> (foobar 5)
5 {:foo :bar}
nil



Now's the moment when someone shows a better way ;)

-R

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



procedural docstring attachment

2009-07-06 Thread Timothy Pratley

I have a function that relies on a keyword being supplied. The keyword
is used to find something in a static map. I want to put in the doc-
string:
(str "blah blah blah, arg1 must be one of " (keys map))
Suggestions?
--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Calling static methods on a variable holding a class

2009-07-06 Thread Adrian Cuthbertson
Hi Nicolas, sorry, that last post missed the second part, I meant to add;

If you know the method you wish to call, do you not know the class and can
thus call the static method directly?

-Adrian.

On Tue, Jul 7, 2009 at 5:21 AM, Adrian Cuthbertson <
adrian.cuthbert...@gmail.com> wrote:

> You can call the static method directly on the class name;
>
> (java.nio.ByteBuffer/allocate 1024)
>
> or just (ByteBuffer/allocat 1024)
> if it's imported.
>
> Rgds, Adrian.
>
>
> On Tue, Jul 7, 2009 at 2:16 AM, Nicolas Buduroi wrote:
>
>>
>> I've just figured out that the macro version in the allocate example
>> can't be  used with local variables.
>>
>> (let [foo ByteBuffer]
>>  (allocate1 foo 1024))
>>
>> throws java.lang.UnsupportedOperationException: Can't eval locals
>> (NO_SOURCE_FILE:94)
>>
>> On Jul 6, 6:59 pm, Nicolas Buduroi  wrote:
>> > Hi, I needed to call a static method on a class stored in a var
>> > yesterday and found that it was a little bit trickier than I initially
>> > thought. There's three way of doing it, the two first are quite
>> > straightforward and working ;-) e.g.:
>> >
>> > (import '(java.nio ByteBuffer FloatBuffer))
>> >
>> > (def foo ByteBuffer)
>> >
>> > (. foo (allocate 1024)) ; throw an exception as intended.
>> >
>> > (defmacro allocate1 [buffer-type size]
>> >   `(. ~(eval buffer-type) (allocate ~size)))
>> >
>> > (defn allocate2 [buffer-type size]
>> >   (eval `(. ~buffer-type (allocate ~size
>> >
>> > (allocate1 foo 1024)
>> > (allocate2 foo 1024)
>> >
>> > Both works fine, but I'm still not sure which one is the best. The
>> > third way is to call a static method from the class object, I've tried
>> > something but wasn't able to get it working. It throws some weird
>> > exception, here's the code:
>> >
>> > (defn to-primitive [class]
>> >  (try
>> >  (let [type (.getField (identity class) "TYPE")]
>> >(.get type Object))
>> >  (catch NoSuchFieldException _ class)))
>> >
>> > (defmacro call-static [class name & args]
>> >  (let [arg-types (into-array
>> >  (map (comp to-primitive #(.getClass %)) args))
>> >   method (.getMethod (eval class) name arg-types)]
>> >   `(.invoke ~method ~class ~...@args)))
>> >
>> > When calling this macro (call-static foo "allocate" 1024) it throws:
>> > java.lang.RuntimeException: Can't embed object in code, maybe print-
>> > dup not defined: public static java.nio.ByteBuffer
>> > java.nio.ByteBuffer.allocate(int) (NO_SOURCE_FILE:0)
>> >
>> > This error message is quite puzzling isn't it?
>> >
>> > Is there any other way?
>> >
>> > Thanks
>> >
>> > - budu
>> >>
>>
>

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Calling static methods on a variable holding a class

2009-07-06 Thread Adrian Cuthbertson
You can call the static method directly on the class name;

(java.nio.ByteBuffer/allocate 1024)

or just (ByteBuffer/allocat 1024)
if it's imported.

Rgds, Adrian.

On Tue, Jul 7, 2009 at 2:16 AM, Nicolas Buduroi  wrote:

>
> I've just figured out that the macro version in the allocate example
> can't be  used with local variables.
>
> (let [foo ByteBuffer]
>  (allocate1 foo 1024))
>
> throws java.lang.UnsupportedOperationException: Can't eval locals
> (NO_SOURCE_FILE:94)
>
> On Jul 6, 6:59 pm, Nicolas Buduroi  wrote:
> > Hi, I needed to call a static method on a class stored in a var
> > yesterday and found that it was a little bit trickier than I initially
> > thought. There's three way of doing it, the two first are quite
> > straightforward and working ;-) e.g.:
> >
> > (import '(java.nio ByteBuffer FloatBuffer))
> >
> > (def foo ByteBuffer)
> >
> > (. foo (allocate 1024)) ; throw an exception as intended.
> >
> > (defmacro allocate1 [buffer-type size]
> >   `(. ~(eval buffer-type) (allocate ~size)))
> >
> > (defn allocate2 [buffer-type size]
> >   (eval `(. ~buffer-type (allocate ~size
> >
> > (allocate1 foo 1024)
> > (allocate2 foo 1024)
> >
> > Both works fine, but I'm still not sure which one is the best. The
> > third way is to call a static method from the class object, I've tried
> > something but wasn't able to get it working. It throws some weird
> > exception, here's the code:
> >
> > (defn to-primitive [class]
> >  (try
> >  (let [type (.getField (identity class) "TYPE")]
> >(.get type Object))
> >  (catch NoSuchFieldException _ class)))
> >
> > (defmacro call-static [class name & args]
> >  (let [arg-types (into-array
> >  (map (comp to-primitive #(.getClass %)) args))
> >   method (.getMethod (eval class) name arg-types)]
> >   `(.invoke ~method ~class ~...@args)))
> >
> > When calling this macro (call-static foo "allocate" 1024) it throws:
> > java.lang.RuntimeException: Can't embed object in code, maybe print-
> > dup not defined: public static java.nio.ByteBuffer
> > java.nio.ByteBuffer.allocate(int) (NO_SOURCE_FILE:0)
> >
> > This error message is quite puzzling isn't it?
> >
> > Is there any other way?
> >
> > Thanks
> >
> > - budu
> >
>

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: I/O in Nailgun

2009-07-06 Thread George Jahad

Hey Phil:

I think it is just an input stream encoding problem.  I think if you
change this line:
(copy (-> context .in) out)

to this:
(copy (-> context .in InputStreamReader.) out)

it will work.

George

On Jul 6, 5:06 pm, Phil Hagelberg  wrote:
> So a common counter to "the VM startup time is so bad" problem is to use
> Nailgun for a long-running server process. I've gotten this working in
> some respects, but I get a "Unexpected chunk type 83 ('S')" error quite
> often when I'm trying to read from the stdin that the nailgun context
> provides.
>
> (ns nailgun.example
>   (:use [clojure.contrib.duck-streams])
>   (:import [com.martiansoftware.nailgun NGServer NGContext]
>            [java.io BufferedReader InputStreamReader
>             OutputStreamWriter PrintWriter])
>   (:gen-class))
>
> (gen-class :name nailgun.Example
>            :prefix "Example-"
>            :methods [#^{:static true}
>                      [nailMain [com.martiansoftware.nailgun.NGContext] void]]
>            :main false)
>
> (defn Example-nailMain
>   [#^NGContext context]
>   (let [out (writer (-> context .out))]
>     (copy (-> context .in) out)
>     (.flush out)))
>
> (defn -main []
>   (.start (Thread. (NGServer.
>
> I compile this, and then run the nailgun.example class. Then I try to
> connect via the ng client:
>
> p...@dynabook ~ $ echo "hello" | ng nailgun.Example
> Unexpected chunk type 83 ('S')
> bash: echo: write error: Broken pipe
> p...@dynabook ~ $ echo "hello" | ng nailgun.Example
> p...@dynabook ~ $ echo "hello" | ng nailgun.Example
> p...@dynabook ~ $ echo "hello" | ng nailgun.Example
> Unexpected chunk type 83 ('S')
> bash: echo: write error: Broken pipe
> p...@dynabook ~ $ echo "hello" | ng nailgun.Example
> p...@dynabook ~ $ echo "hello" | ng nailgun.Example
> Unexpected chunk type 83 ('S')
>
> I've taken a look at the "nails.clj" file in vimclojure since I know
> that it uses nailgun. The only difference seems to be that it wraps the
> context's input stream in a LineNumberingPushbackReader as well as an
> InputStreamReader, but that doesn't seem to make a difference.
>
> Any ideas what I'm doing wrong? How is this supposed to be used?
>
> thanks,
> Phil
--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



swank-clojure bug fix

2009-07-06 Thread Sudish Joseph

Hi,

The patch below fixes the computation of swank-version, which broke when
(clojure-version) was defined to returned a string.  The bug only
manifests itself if swank-clojure-compile-p is set to t.

-Sudish Joseph

From: Sudish Joseph 
Date: Mon, 1 Jun 2009 19:18:11 -0400
Subject: [PATCH] clojure-version is now a string, tweak swank-version to match.

---
 swank/loader.clj |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/swank/loader.clj b/swank/loader.clj
index 5f079f1..8a79025 100644
--- a/swank/loader.clj
+++ b/swank/loader.clj
@@ -55,8 +55,8 @@
 (defn swank-version
   "A likely bad way of calculating a version number for swank clojure"
   ([]
- (+ (reduce + (map file-last-modified (swank-source-files 
*swank-source-path*)))
-(clojure-version
+ (str (reduce + (map file-last-modified (swank-source-files 
*swank-source-path*)))
+ "+" (clojure-version
 
 (defn delete-file-recursive [& paths]
   (when-not (empty? paths)
-- 
1.6.3.1


--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: loneclojurian at ICFP programming contest

2009-07-06 Thread Bradbev

On Jul 6, 4:30 pm, fft1976  wrote:
> On Jul 5, 11:42 pm, Bradbev  wrote:
>
> > more to modern x86 chips.  After you have the best algorithm for the
> > job, you very quickly find that going fast is entirely bound by memory
> > speed (actually latency) - cache misses are the enemy.
>
> IME (outside JVM), this depends strongly on the kind of problem you
> are solving as well as your implementation (you need to know how to
> cache-optimize). One can easily think of problems that would fit
> entirely in cache, but take an enormous amount of time.
What sort of problems did you have in mind?  Anything that I can think
of quickly spills the cache.

Cheers,
Brad
--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Calling static methods on a variable holding a class

2009-07-06 Thread Nicolas Buduroi

I've just figured out that the macro version in the allocate example
can't be  used with local variables.

(let [foo ByteBuffer]
  (allocate1 foo 1024))

throws java.lang.UnsupportedOperationException: Can't eval locals
(NO_SOURCE_FILE:94)

On Jul 6, 6:59 pm, Nicolas Buduroi  wrote:
> Hi, I needed to call a static method on a class stored in a var
> yesterday and found that it was a little bit trickier than I initially
> thought. There's three way of doing it, the two first are quite
> straightforward and working ;-) e.g.:
>
> (import '(java.nio ByteBuffer FloatBuffer))
>
> (def foo ByteBuffer)
>
> (. foo (allocate 1024)) ; throw an exception as intended.
>
> (defmacro allocate1 [buffer-type size]
>   `(. ~(eval buffer-type) (allocate ~size)))
>
> (defn allocate2 [buffer-type size]
>   (eval `(. ~buffer-type (allocate ~size
>
> (allocate1 foo 1024)
> (allocate2 foo 1024)
>
> Both works fine, but I'm still not sure which one is the best. The
> third way is to call a static method from the class object, I've tried
> something but wasn't able to get it working. It throws some weird
> exception, here's the code:
>
> (defn to-primitive [class]
>  (try
>  (let [type (.getField (identity class) "TYPE")]
>    (.get type Object))
>  (catch NoSuchFieldException _ class)))
>
> (defmacro call-static [class name & args]
>  (let [arg-types (into-array
>                  (map (comp to-primitive #(.getClass %)) args))
>       method (.getMethod (eval class) name arg-types)]
>   `(.invoke ~method ~class ~...@args)))
>
> When calling this macro (call-static foo "allocate" 1024) it throws:
> java.lang.RuntimeException: Can't embed object in code, maybe print-
> dup not defined: public static java.nio.ByteBuffer
> java.nio.ByteBuffer.allocate(int) (NO_SOURCE_FILE:0)
>
> This error message is quite puzzling isn't it?
>
> Is there any other way?
>
> Thanks
>
> - budu
--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: loneclojurian at ICFP programming contest

2009-07-06 Thread fft1976

On Jul 5, 11:42 pm, Bradbev  wrote:

> more to modern x86 chips.  After you have the best algorithm for the
> job, you very quickly find that going fast is entirely bound by memory
> speed (actually latency) - cache misses are the enemy.

IME (outside JVM), this depends strongly on the kind of problem you
are solving as well as your implementation (you need to know how to
cache-optimize). One can easily think of problems that would fit
entirely in cache, but take an enormous amount of time.

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



I/O in Nailgun

2009-07-06 Thread Phil Hagelberg


So a common counter to "the VM startup time is so bad" problem is to use
Nailgun for a long-running server process. I've gotten this working in
some respects, but I get a "Unexpected chunk type 83 ('S')" error quite
often when I'm trying to read from the stdin that the nailgun context
provides.

(ns nailgun.example
  (:use [clojure.contrib.duck-streams])
  (:import [com.martiansoftware.nailgun NGServer NGContext]
   [java.io BufferedReader InputStreamReader
OutputStreamWriter PrintWriter])
  (:gen-class))

(gen-class :name nailgun.Example
   :prefix "Example-"
   :methods [#^{:static true}
 [nailMain [com.martiansoftware.nailgun.NGContext] void]]
   :main false)

(defn Example-nailMain
  [#^NGContext context]
  (let [out (writer (-> context .out))]
(copy (-> context .in) out)
(.flush out)))

(defn -main []
  (.start (Thread. (NGServer.

I compile this, and then run the nailgun.example class. Then I try to
connect via the ng client:

p...@dynabook ~ $ echo "hello" | ng nailgun.Example
Unexpected chunk type 83 ('S')
bash: echo: write error: Broken pipe
p...@dynabook ~ $ echo "hello" | ng nailgun.Example
p...@dynabook ~ $ echo "hello" | ng nailgun.Example
p...@dynabook ~ $ echo "hello" | ng nailgun.Example
Unexpected chunk type 83 ('S')
bash: echo: write error: Broken pipe
p...@dynabook ~ $ echo "hello" | ng nailgun.Example
p...@dynabook ~ $ echo "hello" | ng nailgun.Example
Unexpected chunk type 83 ('S')

I've taken a look at the "nails.clj" file in vimclojure since I know
that it uses nailgun. The only difference seems to be that it wraps the
context's input stream in a LineNumberingPushbackReader as well as an
InputStreamReader, but that doesn't seem to make a difference.

Any ideas what I'm doing wrong? How is this supposed to be used?

thanks,
Phil

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread Richard Newman

> Since it's not apparently a simple bug in my function above, but  
> something about a combination of that version of that function and  
> some other part of my code, I can't think of a way to track the  
> cause down short of the very tedious method of commenting out  
> functions or replacing them with dummy functions (if they're called  
> by the above function) and seeing which one has the property that  
> commenting it out or dummy-izing it makes the error go away.
>
> That will probably take all afternoon, unfortunately; there are  
> dozens of functions and over 1600 lines of code in that source file.

Have you tried simpler things like splitting the offending function  
into a separate namespace, or seeing what happens with (or without)  
AOT compilation?

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread John Harrop
On Mon, Jul 6, 2009 at 3:58 PM, Emeka  wrote:

>  (defn- subexpressions-of-sum** [[n p] terms]
>  (let-print [sum (cons '+ (map #(factor-term % n p) terms))
>prod (rest (make-product* n p))]
>(cons sum
>  (map #(cons '* (cons sum (rest %)))
>(concat prod (subexpressions-of-product prod))
>
> I look at the above, and something stupid just entered into my thought.
> What happened when this situation occurs (cons sum ())? I hope that's not
> possible with your code.
>

It shouldn't be. Even if it is, there'd just be some (* sum) in the results,
which is inefficient but not illegitimate.

I don't see any way that this could be the cause of the ClassFormatError, in
particular.

Frankly, I am starting to suspect a bug in clojure. I'm using the stable
1.0, not the bleeding edge stuff. Whether the occurrence of the
ClassFormatError itself is down to a subtle error in my code (so subtle
no-one can spot it) or an error in clojure, its failure to point to a line
in my source file as the erroneous one is in and of itself a bug, I'd argue.

Since it's not apparently a simple bug in my function above, but something
about a combination of that version of that function and some other part of
my code, I can't think of a way to track the cause down short of the very
tedious method of commenting out functions or replacing them with dummy
functions (if they're called by the above function) and seeing which one has
the property that commenting it out or dummy-izing it makes the error go
away.

That will probably take all afternoon, unfortunately; there are dozens of
functions and over 1600 lines of code in that source file.

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Is this unquote dangerous?

2009-07-06 Thread John Harrop
>
> Or if you really do need a list:
>
>  (for [x [1 2 3]] (cons 'some-symbol (list x)))
>

Why not

(for [x [1 2 3]] (list 'some-symbol x))

?

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Calling static methods on a variable holding a class

2009-07-06 Thread Nicolas Buduroi

Hi, I needed to call a static method on a class stored in a var
yesterday and found that it was a little bit trickier than I initially
thought. There's three way of doing it, the two first are quite
straightforward and working ;-) e.g.:

(import '(java.nio ByteBuffer FloatBuffer))

(def foo ByteBuffer)

(. foo (allocate 1024)) ; throw an exception as intended.

(defmacro allocate1 [buffer-type size]
  `(. ~(eval buffer-type) (allocate ~size)))

(defn allocate2 [buffer-type size]
  (eval `(. ~buffer-type (allocate ~size

(allocate1 foo 1024)
(allocate2 foo 1024)

Both works fine, but I'm still not sure which one is the best. The
third way is to call a static method from the class object, I've tried
something but wasn't able to get it working. It throws some weird
exception, here's the code:

(defn to-primitive [class]
 (try
 (let [type (.getField (identity class) "TYPE")]
   (.get type Object))
 (catch NoSuchFieldException _ class)))

(defmacro call-static [class name & args]
 (let [arg-types (into-array
 (map (comp to-primitive #(.getClass %)) args))
  method (.getMethod (eval class) name arg-types)]
  `(.invoke ~method ~class ~...@args)))

When calling this macro (call-static foo "allocate" 1024) it throws:
java.lang.RuntimeException: Can't embed object in code, maybe print-
dup not defined: public static java.nio.ByteBuffer
java.nio.ByteBuffer.allocate(int) (NO_SOURCE_FILE:0)

This error message is quite puzzling isn't it?

Is there any other way?

Thanks

- budu

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Is this unquote dangerous?

2009-07-06 Thread Chouser

On Mon, Jul 6, 2009 at 4:18 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 06.07.2009 um 22:00 schrieb Chouser:
>
>> Or if you really do need a list:
>>
>>  (for [x [1 2 3]] (cons 'some-symbol (list x)))
>
> o.O
>
> *cough*(list 'some-symbol x)*cough* ;)

Oh.  Right.  What he said.

--Chouser

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Is this unquote dangerous?

2009-07-06 Thread Meikel Brandmeyer

Hi,

Am 06.07.2009 um 22:00 schrieb Chouser:


Or if you really do need a list:

 (for [x [1 2 3]] (cons 'some-symbol (list x)))


o.O

*cough*(list 'some-symbol x)*cough* ;)

Sincerely
Meikel

smime.p7s
Description: S/MIME cryptographic signature


Re: Is this unquote dangerous?

2009-07-06 Thread Chouser

On Mon, Jul 6, 2009 at 3:47 PM, Sean Devlin wrote:
>
> I think your unquote is okay.  ClojureQL does something similar.
>
> However, my gut says this should be in a doseq, not a for statement.
> Could be totally wrong, tough.

I think the OP is trying to build and return a list, not
trying to execute a series of operations.  If I'm right,
then 'for' is better than 'doseq'.

> On Jul 6, 2:39 pm, Mike  wrote:
>> Newbie question here.  Probably answered in Stu's book, but I forgot
>> it at home today.
>>
>> is:
>>
>> (for [x [1 2 3]] `(some-symbol ~x))
>>
>> dangerous?  I mean, assuming that some-symbol is bound and all.  At
>> the REPL I get
>>
>> ((user/some-symbol 1) (user/some-symbol 2) (user/some-symbol 3))
>>
>> which is what I'm interested in getting, but somehow the fact that
>> "for" is a macro and I'm escaping x assuming it's there is
>> disconcerting.

I can't think of any way in which it's dangerous.  Is it
important to you that the symbol become fully-qualified?  If
so, then what you've got is fine -- are you writing a macro?

If some-symbol is not referring to a Var, though, it's more
likely you want a regular quote than a syntax quote, in
which case it may be more idiomatic to build a vector:

  (for [x [1 2 3]] ['some-symbol x])

Or if you really do need a list:

  (for [x [1 2 3]] (cons 'some-symbol (list x)))

--Chouser

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Laurent PETIT

Hi,

2009/7/6 Stephen C. Gilardi :
>
> On Jul 6, 2009, at 3:13 PM, Tom Emerson wrote:
>
> Thanks Paul, for the quick response.
>
> On Mon, Jul 6, 2009 at 12:56 PM, Phil Hagelberg wrote:
>
> That's right. Side note to folks with commit access: it would be a good
>
> idea to check in a note to the deprecated repositories telling people
>
> where to go for the latest versions.
>
> Or, better, do away with those obsolete repos entirely. But whatever.
>
> In the case of SourceForge, they have a strong preference for keeping old
> repos around. I think it's confusing, but I recall looking into it and
> finding that was their policy. I'm not sure whether or not Google Code has a
> similar preference. Some clear, local indication in each repository that
> marks it as "no longer maintained, see clojure.org for current info" would
> be a win of course.
>

I think there could be a way to make both parts happy : rather than
just adding the info that it is an old repo in some README file in the
root directory of the svn repo, committing also an svn delete command
on all the contents of trunk could help clarify this : by default,
users checking (or updating !) trunk would have an empty working copy
as a result (and also just the informative README file).
But tags would still be there, and also the entire repository history,
as a svn delete is just deleting files in the commited revision, not
deleting the history (one could retrieve a working copy by just
emitting svn up -r N-1  where N would be the "deletion" commit.

HTH,

-- 
Laurent

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread Emeka
 (defn- subexpressions-of-sum** [[n p] terms]
 (let-print [sum (cons '+ (map #(factor-term % n p) terms))
   prod (rest (make-product* n p))]
   (cons sum
 (map #(cons '* (cons sum (rest %)))
   (concat prod (subexpressions-of-product prod))

I look at the above, and something stupid just entered into my thought. What
happened when this situation occurs (cons sum ())? I hope that's not
possible with your code.

Regards,
Emeka

On Sun, Jul 5, 2009 at 6:01 AM, John Harrop  wrote:

>
> I had this:
>
> (defn- subexpressions-of-sum** [[n p] terms]
>  (let-print [sum (cons '+ (map #(factor-term % n p) terms))
>prod (rest (make-product* n p))]
>(concat [sum] (subexpressions-of-product (cons sum prod)
>
> in a source file with other definitions. Load-file worked. I then
> changed it to this:
>
> (defn- subexpressions-of-sum** [[n p] terms]
>  (let-print [sum (cons '+ (map #(factor-term % n p) terms))
>prod (rest (make-product* n p))]
>(cons sum
>  (map #(cons '* (cons sum (rest %)))
>(concat prod (subexpressions-of-product prod))
>
> and got:
>
> # 32 in class file com/mycompany/myfile$eval__14598 (NO_SOURCE_FILE:0)>
>
> when I tried to do a load-file.
>
> That function definition was the ONLY thing I changed, but I'm at a
> loss to find any kind of error in it. Delimiters balance, all of the
> referenced functions exist, basically there's nothing wrong.
>
> The full exception trace, which required evaluating (.printStackTrace
> (.getCause *e)) at the repl, is:
>
> java.lang.ClassFormatError: Unknown constant tag 32 in class file
> com/mycompany/myfile$eval__14598
>at java.lang.ClassLoader.defineClass1(Native Method)
>at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
>at java.lang.ClassLoader.defineClass(ClassLoader.java:466)
>at
> clojure.lang.DynamicClassLoader.defineClass(DynamicClassLoader.java:42)
>at clojure.lang.Compiler$FnExpr.getCompiledClass(Compiler.java:3417)
>at clojure.lang.Compiler$FnExpr.eval(Compiler.java:3428)
>at clojure.lang.Compiler.eval(Compiler.java:4531)
>at clojure.core$eval__3990.invoke(core.clj:1728)
>at
> clojure.main$repl__5813$read_eval_print__5825.invoke(main.clj:176)
>at clojure.main$repl__5813.doInvoke(main.clj:193)
>at clojure.lang.RestFn.invoke(RestFn.java:548)
>at
> org.enclojure.repl.main$create_clojure_repl__53$repl_thread_fn__55.invoke(main.clj:96)
>at clojure.lang.AFn.run(AFn.java:37)
>at java.lang.Thread.run(Thread.java:619)
>
> It does not point to any line of my source file.
>
> Perhaps the rewritten version of the function provokes a compiler bug?
> If there is a known bug that would cause this, let me know of the
> known workaround. If there is an error in the second version of my
> function, let me know. (It has intentionally different semantics from
> the first version, so that's not an error in and of itself.)
>
> >
>

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Is this unquote dangerous?

2009-07-06 Thread Sean Devlin

I think your unquote is okay.  ClojureQL does something similar.

However, my gut says this should be in a doseq, not a for statement.
Could be totally wrong, tough.

My $.02

Sean

On Jul 6, 2:39 pm, Mike  wrote:
> Newbie question here.  Probably answered in Stu's book, but I forgot
> it at home today.
>
> is:
>
> (for [x [1 2 3]] `(some-symbol ~x))
>
> dangerous?  I mean, assuming that some-symbol is bound and all.  At
> the REPL I get
>
> ((user/some-symbol 1) (user/some-symbol 2) (user/some-symbol 3))
>
> which is what I'm interested in getting, but somehow the fact that
> "for" is a macro and I'm escaping x assuming it's there is
> disconcerting.
>
> Thanks for any style tips...
> Mike
--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Tom Emerson

Thanks Stu, Mike, and Stephen for your responses: I appreciate the help.

@Stephen, these are all horses not worth kicking any further. Thanks
for the git links.

@Stu, I'll take that under advisement, but I'm not going to install
ruby for that one tool... yet. :)

Thanks again guys,

-tree

On Mon, Jul 6, 2009 at 3:37 PM, Stuart
Halloway wrote:
>
> I strongly recommend using grb (http://grb.rubyforge.org/) as a
> wrapper for remote-branch-related stuff. It provides a convenient
> terminal API, and will tell you the git commands it is using under the
> hood.
>
> Stu
>
>> So I guess my unstated question is this: what is the GIT incantation
>> to get a particular branch of a repository (or whatever the GIT
>> terminology is for it)? The documentation for git-clone doesn't help
>> much, and none of the tutorials I've read seem to talk about this.
>
> >
>



-- 
Tom Emerson
tremer...@gmail.com
http://treerex.blogspot.com/

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Stuart Halloway

I strongly recommend using grb (http://grb.rubyforge.org/) as a  
wrapper for remote-branch-related stuff. It provides a convenient  
terminal API, and will tell you the git commands it is using under the  
hood.

Stu

> So I guess my unstated question is this: what is the GIT incantation
> to get a particular branch of a repository (or whatever the GIT
> terminology is for it)? The documentation for git-clone doesn't help
> much, and none of the tutorials I've read seem to talk about this.

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread John Harrop
On Mon, Jul 6, 2009 at 8:53 AM, Chouser  wrote:

>
> On Sun, Jul 5, 2009 at 3:51 PM, John Harrop wrote:
> >
> > This is frankly quite baffling. The changes to the function are
> > innocent from a large-literal or pretty much any other perspective.
>
> Both your functions load fine for me without the rest of
> your code.  Are there type hints on the return values of any
> of the functions called in your examples?
>

Not that I know of. Called macros above are let-print; called functions are
cons, map, factor-term, rest, make-product*, concat, and
subexpressions-of-product. All are called by both versions; cons, map, rest,
and concat are the clojure.core versions and let-print is just

(defmacro let-print [bindings & body]
  `(let ~bindings ~@(map (fn [x#] `(println ~x#))
  (take-nth 2 bindings)) ~...@body))

which I find handy sometimes when debugging, because I can just slap a
"-print" at the end of a let to add some debugging dumps to the console
output. (I also have eval-print and intend to add loop-print to dump loop
variables every time around the loop.)

I had been debugging the above function, which work led to the change that
triggered the new problem. Interestingly, changing the "let-print" back to
"let" alters the error message, specifically, the cryptic number after
"unknown constant tag", but has no other effect.

The functions factor-term, make-product*, and subexpressions-of-product have
all been working for ages, and have not changed recently. None type-hints
anything, return value or otherwise.

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Is this unquote dangerous?

2009-07-06 Thread Mike

Newbie question here.  Probably answered in Stu's book, but I forgot
it at home today.

is:

(for [x [1 2 3]] `(some-symbol ~x))

dangerous?  I mean, assuming that some-symbol is bound and all.  At
the REPL I get

((user/some-symbol 1) (user/some-symbol 2) (user/some-symbol 3))

which is what I'm interested in getting, but somehow the fact that
"for" is a macro and I'm escaping x assuming it's there is
disconcerting.

Thanks for any style tips...
Mike

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Mike Hinchey
After you do the git clone, cd into clojure, then:
git checkout remotes/origin/1.0

For clojure-contrib:
git checkout remotes/origin/clojure-1.0-compatible

-Mike

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Stephen C. Gilardi


On Jul 6, 2009, at 3:13 PM, Tom Emerson wrote:


Thanks Paul, for the quick response.

On Mon, Jul 6, 2009 at 12:56 PM, Phil Hagelberg  
wrote:
That's right. Side note to folks with commit access: it would be a  
good

idea to check in a note to the deprecated repositories telling people
where to go for the latest versions.


Or, better, do away with those obsolete repos entirely. But whatever.


In the case of SourceForge, they have a strong preference for keeping  
old repos around. I think it's confusing, but I recall looking into it  
and finding that was their policy. I'm not sure whether or not Google  
Code has a similar preference. Some clear, local indication in each  
repository that marks it as "no longer maintained, see clojure.org for  
current info" would be a win of course.



[snip]

Someone recently branched a 1.0-compatible contrib. I don't think
there's a tarball for it yet. IIUC the only breaking change so far  
has

been the move of test-is out of contrib to Clojure itself.


So I guess my unstated question is this: what is the GIT incantation
to get a particular branch of a repository (or whatever the GIT
terminology is for it)? The documentation for git-clone doesn't help
much, and none of the tutorials I've read seem to talk about this.


This has some good info about that:

http://stackoverflow.com/questions/67699/how-do-i-clone-all-remote-branches-with-git

(Google: git clone remote branch)

Other git links I've found useful:

http://cheat.errtheblog.com/s/git
http://www.sourcemage.org/Git_Guide
http://webjazz.blogspot.com/2008/07/git-remote-branch-notes.html
http://toolmantim.com/articles/setting_up_a_new_remote_git_repository

--Steve



smime.p7s
Description: S/MIME cryptographic signature


Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Tom Emerson

Thanks Paul, for the quick response.

On Mon, Jul 6, 2009 at 12:56 PM, Phil Hagelberg wrote:
> That's right. Side note to folks with commit access: it would be a good
> idea to check in a note to the deprecated repositories telling people
> where to go for the latest versions.

Or, better, do away with those obsolete repos entirely. But whatever.

[snip]
> Someone recently branched a 1.0-compatible contrib. I don't think
> there's a tarball for it yet. IIUC the only breaking change so far has
> been the move of test-is out of contrib to Clojure itself.

So I guess my unstated question is this: what is the GIT incantation
to get a particular branch of a repository (or whatever the GIT
terminology is for it)? The documentation for git-clone doesn't help
much, and none of the tutorials I've read seem to talk about this.

[snip]
> Once we make changes to clojure-mode and swank-clojure, we'll be sure to
> tag the last versions that work with 1.0. Until then you can just use
> the master branch.

Cool, will do.

Thanks again!

-tree

-- 
Tom Emerson
tremer...@gmail.com
http://treerex.blogspot.com/

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: print-base / print-radix?

2009-07-06 Thread Tom Faulhaber

OK, as of clojure-contrib commit 0d29198..., *print-base* and *print-
radix* are fully supported for the various integer classes and ratios
in cl-format, write, and pprint.

e.g.:

(binding [*print-base* 2, *print-radix* true] (pprint (range 4)))
=>
(#b0 #b1 #b10 #b11)

Please let me know if you see any problems.

Enjoy!

Tom

On Jul 5, 7:20 pm, Parth  wrote:
> On Jul 5, 9:02 pm, Tom Faulhaber  wrote:
>
> > Parth,
>
> > I've created a little wrapper as promised at:http://gist.github.com/141001.
>
> > It gives you my-pprint:
>
> > user> (binding [*print-base* 2] (my-pprint (range 10)))
> > (0 1 10 11 100 101 110 111 1000 1001)
> > nil
> > user>
>
> Thanks Tom. This works beautifully :)
>
> Here is the example that earlier example in the thread:
>
> user=> (binding [wrap-base/*print-base* 16] (wrap-base/my-pprint
> (decode :b32 (test-ops 3
> {:inst
>  {:prefix (),
>   :code (c7 45 f8 a 0 0 0),
>   :op :movl,
>   :args [{:type :Ev-mem, :arg {:reg :ebp, :disp -8}} a]},
>  :more ()}
> nil
> user=>
>
> > While doing this, I realized to my horror that ~r doesn't do 0
> > correctly for non-standard bases. I'll fix that soon.
>
> > Also, I've started to implement *print-radix* and *print-base* for
> > real in cl-format and the pretty printer, so those should be available
> > soon.
>
> Fantastic ... pprint just keeps getting better :)
>
> Regards,
> Parth
>
> > Enjoy,
>
> > Tom
>
> > On Jul 3, 3:16 am, Parth  wrote:
>
> > > On Jul 3, 11:25 am, Tom Faulhaber  wrote:
>
> > > > Parth,
>
> > > > I was thinking about this a little more today and I came up with a way
> > > > to extend the pretty printer easily to support *print-radix* with a
> > > > little wrapper. I'll try to get a chance to write it up for you
> > > > tomorrow.
>
> > > > Tom
>
> > > Sounds perfect. Thanks very much :)
>
> > > Regards,
> > > Parth
>
> > > > On Jul 2, 6:29 pm, Parth  wrote:
>
> > > > > On Jul 3, 6:15 am, Parth  wrote:
>
> > > > > > Tom, Chouser, Thanks for your responses.
>
> > > > > > As of now I am doing the same thing as suggested.
> > > > > > However, this tends be become painful the moment structures
> > > > > > start to nest. For e.g. I am using Clojure to decode a bit
> > > > > > of assembly and below is what I end up doing to see the
> > > > > > values of interest in hex:
>
> > > > > > user=> (decode :b32 (nth test-ops 3))
> > > > > > {:inst {:prefix (), :code (199 69 248 10 0 0 0), :op :movl, :args
> > > > > > [{:type :Ev-mem, :arg {:reg :ebp, :disp -8}} 10]}, :more ()}
> > > > > > user=> (def r (decode :b32 (nth test-ops 3)))
> > > > > > #'user/r
> > > > > > user=> (map hex (get-in r [:inst :code]))
> > > > > > ("c7" "45" "f8" "a" "0" "0" "0")
> > > > > > user=> (hex (second (get-in r [:inst :args])))
> > > > > > "a"
> > > > > > user=>
>
> > > > > > Basically, I need to extract each number seq or value
> > > > > > individually and print it in hex for every instruction I
> > > > > > decode and view.
>
> > > > > > This isn't too much fun to do in the middle of  a debug session :)
>
> > > > > > Having something like *print-base* would be ideal IMHO
> > > > > > would make scenarios like this really easy as one could
> > > > > > simply do:
>
> > > > > > user=> (set! *print-base* 16)
> > > > > > user=> (decode :b32 (nth test-ops 3))
> > > > > > {:inst {:prefix (), :code (c7 47 f8 a 0 0 0), :op :movl, :args
> > > > > > [{:type :Ev-mem, :arg {:reg :ebp, :disp f8}} a]}, :more ()}
>
> > > > > > In the absence of this I thought of writing a function
> > > > > > that would take an arbitrary Clojure structure/coll and print
> > > > > > it out in the manner like above. But then it won't
> > > > > > be much different from pprint with radix support but without
> > > > > > the pretty part.
>
> > > > > > I suppose what I am hoping is that a feature request for
> > > > > > *print-base* sort of a mechanism get considered
> > > > > > for Clojure as it makes scenarios like the above very
> > > > > > easy to deal with. Any chance of this being somewhere
> > > > > > on the Clojue todo? :)
>
> > > > > Rich,
>
> > > > > If this is something you think would be a good addition
> > > > > to Clojure I could give a shot at creating a patch for
> > > > > this (with a CA of course). Please let me know.
>
> > > > > I think rather than a generic radix support, if
> > > > > we have hex, bin and octal supported, most uses
> > > > > cases should be covered.
>
> > > > > Regards,
> > > > > Parth
>
> > > > > > I will probably create a poor mans radix based print
> > > > > > in the mean time for the this scenario. That should
> > > > > > be an interesting exercise.
>
> > > > > > Thanks,
> > > > > > Parth
>
> > > > > > On Jul 2, 10:58 pm, Chouser  wrote:
>
> > > > > > > On Thu, Jul 2, 2009 at 4:51 AM, Parth
>
> > > > > > > Malwankar wrote:
>
> > > > > > > > I frequently deal with hex and binary numbers.
> > > > > > > > As of now when I need to view a list of numbers
> > > > > > > > I just map a little hex function to it to translate it
> > > > > > > > into a list of

Re: [PATCH Emacs/swank-clojure] Add apropos-list-for-emacs

2009-07-06 Thread Phil Hagelberg

Takeshi Banse  writes:

> I Takeshi Banse live in Japan, have been teaching myself Clojure and in the
> process have a patch to the swank-clojure I'd like to make.
>
> With this patch, I can happily `M-x slime-apropos' within Emacs/SLIME.
>
> Hope this helps. Thanks.

Thanks! This is really helpful.

I've applied the patch to my repository and requested it be merged to jochu's.

-Phil

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Phil Hagelberg

Tom Emerson  writes:

> Clojure and Clojure-Contrib have both moved to git and are hosted on
> git-hub, right? Is it then the case that the SVN repository on
> GoogleCode is no longer being used?

That's right. Side note to folks with commit access: it would be a good
idea to check in a note to the deprecated repositories telling people
where to go for the latest versions.

> I can download a zip file containing the Clojure 1.0 release, but I
> cannot find a similar package for the corresponding clojure-contrib
> --- does this not exist? If so, where do I grab it?

Someone recently branched a 1.0-compatible contrib. I don't think
there's a tarball for it yet. IIUC the only breaking change so far has
been the move of test-is out of contrib to Clojure itself.

> On the same track, clojure mode and swank-clojure are git based: were
> these similarly tagged so that there was a stable 1.0 baseline someone
> who does not want to be cut on the bleeding edge can grab?

Once we make changes to clojure-mode and swank-clojure, we'll be sure to
tag the last versions that work with 1.0. Until then you can just use
the master branch.

-Phil

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Tom Emerson

Hi all,

I've been away from Clojure for a while (I was side tracked about a
month before 1.0 was released) and now that I'm back I'm completely
confused.

Clojure and Clojure-Contrib have both moved to git and are hosted on
git-hub, right? Is it then the case that the SVN repository on
GoogleCode is no longer being used?

I can download a zip file containing the Clojure 1.0 release, but I
cannot find a similar package for the corresponding clojure-contrib
--- does this not exist? If so, where do I grab it?

I see there is a tag in git for Clojure 1.0, but I have yet to wrap my
head around git enough to figure out the right incantation to grab
that tagged version. Similarly, I do not see a tag on contrib --- so
how do I know that the version of contrib I could check out from git
(assuming I could figure that out) is compatible with 1.0? Or do I end
up having to grab the trunk (or whatever the git concept of this is)
of both and hope that they work together?

On the same track, clojure mode and swank-clojure are git based: were
these similarly tagged so that there was a stable 1.0 baseline someone
who does not want to be cut on the bleeding edge can grab?

Sorry to sound like a whiner, I'm not trying to be. I'm just
thoroughly confused and would like to find a stable world to start
working in this language again.

Oh, I guess since I am whining, I'll add this ;-) Is this hopefully
the last project management move we'll see for a while? SF -> GC ->
GitHub/Assembla -> ?

Thanks for your help (and patience),

 -tree

-- 
Tom Emerson
tremer...@gmail.com
http://treerex.blogspot.com/

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Displaying Clojure code on a Website

2009-07-06 Thread Kai

Hi Rick,

I think we've both encountered the same concerns with coding style in
Clojure. I can't really say which is better - a large list of
conditions or a mutually recursive implementation. I have a feeling
that it depends on your fluency in functional languages. For me, I'm
relatively new to the functional scene and so I tend to find
sequential code to be rhythmic, like you. On the other hand, I can
certainly see how somebody who thinks more functionally would be able
to clearly read the twists and turns of mutual recursion, and it seems
like a solution with many functions would be more modular and
therefore easily extensible.

Also, I wouldn't say that trampolining isn't widely understood.
There's just not many use cases for it in the types of projects we've
been doing. I remember a time when recursion was difficult but the
intricacies passed very fast once I stuck to it :)

~ Kai

On Jul 3, 6:13 pm, Rick Moynihan  wrote:
> Hi Kai,
>
> 2009/7/2 Kai :
>
> > @Rick
>
> > I got fairly far into this before I had problems with stack overflows.
> > I found out later than I needed knowledge of trampoline and mutual
> > recursion to solve the issue. I think the approach still has potential
> > but the setback forced me to consider other options. This lead me to
> > implement the stack local in the recursive definition of parse-code.
>
> Thanks for your comprehensive answer.  I've read about
> mutually-recursive functions but never really known where these issues
> might occur in the wild outside of Stuart's discussion of trampolines
> in Programming Clojure.  As I wrote my previous email I began to
> suspect by the liberal recur's that this was the case (it's amazing
> the amount of times through writing an email asking a question about
> some code you stumble upon the solution), though I'm really glad
> you've cleared this up for me.
>
> Is it fair to say that you've made a trade off here?  i.e. it seems
> you're trading off the costs associated with having a large function
> definition against the less widely understood techniques of mutual
> recursion and trampolining?  If so I'm inclined to agree that this is
> a fair trade off, particularly because of the rhythmic nature of the
> code and of course the fact that by using recur you're codifying a
> guarantee to your readers that you're tail calling.
>
> I am now curious as to whether or not this program would be clearer
> with trampolines.
>
> Thanks again for sharing and enlightening us with your discussion!
>
> R.
--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Flag spam in files?

2009-07-06 Thread Sean Devlin

Hey everyone,
I've noticed on several occasions there's spam in the file section
(like right now.  e.g. "SexyBabe.html").

What's the preferred approach to handle this:

1.  Ignore it
2.  Mention it on this list
3.  Use a system for tagging files as spam
4.  Some other idea?
--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Add apropos-list-for-emacs

2009-07-06 Thread JLR



On Jul 2, 7:46 am, Takeshi Banse  wrote:

> Hi all,
> I Takeshi Banse live in Japan, have been teaching myself Clojure and in the
> process have a patch to theswank-clojure I'd like to make.
>
> With this patch, I can happily `M-x slime-apropos' within Emacs/SLIME.
>
> Hope this helps. Thanks.
>


This is fantastic. I look forward to seeing it in the main swank-
clojure.

Thanks for writing it, that's great. Also to Jeffrey Chu for his
substantial work on this project.

I note that Phil Hagelberg's swank-clojure tree[1] has a file that was
updated just 3 days ago (today is Jul. 6). The official jochu tree[2]
was last updated a month ago - early June. It looks like Phil might be
able to integrate this and then send a request to jochu to
synchronize, which would make it easier if jochu can't take care of it
right away?

You might consider contacting Phil. His email can be found at the
website below[3].

It's great to see these development tools keep growing - Clojure may
yet wind up having one of the nicest overall language environments to
work in. Thank you guys for working on it.

[1] - http://github.com/technomancy/swank-clojure/tree/master
[2] - http://github.com/jochu/swank-clojure/tree/master
[3] - http://github.com/technomancy


>  swank/commands/basic.clj |   61 
> ++
>  1 files changed, 61 insertions(+), 0 deletions(-)
>
> diff --git a/swank/commands/basic.clj b/swank/commands/basic.clj
> index 47555a4..d668d2d 100644
> --- a/swank/commands/basic.clj
> +++ b/swank/commands/basic.clj
> @@ -161,6 +161,67 @@ (defslimefn documentation-symbol
>    ([symbol-name default] (documentation-symbol symbol-name))
>    ([symbol-name] (describe-symbol* symbol-name)))
>
> + Documentation
> +
> +(defn- briefly-describe-symbol-for-emacs [var]
> +  (let [lines (fn [s] (seq (.split s (System/getProperty "line.separator"
> +        [_ symbol-name arglists d1 d2 & __] (lines (describe-to-string var))
> +        macro? (= d1 "Macro")]
> +    (list :designator symbol-name
> +          (cond
> +            macro? :macro
> +            (:arglists ^var) :function
> +            :else :variable)
> +          (apply str (concat arglists (if macro? d2 d1))
> +
> +(defn- make-apropos-matcher [pattern case-sensitive?]
> +  (let [pattern (java.util.regex.Pattern/quote pattern)
> +        pat (re-pattern (if case-sensitive?
> +                          pattern
> +                          (format "(?i:%s)" pattern)))]
> +    (fn [var] (re-find pat (pr-str var)
> +
> +(defn- apropos-symbols [string external-only? case-sensitive? package]
> +  (let [packages (or (when package [package]) (all-ns))
> +        matcher (make-apropos-matcher string case-sensitive?)
> +        lister (if external-only? ns-publics ns-interns)]
> +    (filter matcher
> +            (apply concat (map (comp (partial map second) lister)
> +                               packages)
> +
> +(defn- present-symbol-before
> +  "Comparator such that x belongs before y in a printed summary of symbols.
> +Sorted alphabetically by namespace name and then symbol name, except
> +that symbols accessible in the current namespace go first."
> +  [x y]
> +  (let [accessible?
> +        (fn [var] (= (ns-resolve (maybe-ns *current-package*) (:name ^var))
> +                     var))
> +        ax (accessible? x) ay (accessible? y)]
> +    (cond
> +      (and ax ay) (compare (:name ^x) (:name ^y))
> +      ax -1
> +      ay 1
> +      :else (let [nx (str (:ns ^x)) ny (str (:ns ^y))]
> +              (if (= nx ny)
> +                (compare (:name ^x) (:name ^y))
> +                (compare nx ny))
> +
> +(defslimefn apropos-list-for-emacs
> +  ([name]
> +     (apropos-list-for-emacs name nil))
> +  ([name external-only?]
> +     (apropos-list-for-emacs name external-only? nil))
> +  ([name external-only? case-sensitive?]
> +     (apropos-list-for-emacs name external-only? case-sensitive? nil))
> +  ([name external-only? case-sensitive? package]
> +     (let [package (when package
> +                     (or (find-ns (symbol package))
> +                         'user))]
> +       (map briefly-describe-symbol-for-emacs
> +            (sort present-symbol-before
> +                  (apropos-symbols name external-only? case-sensitive?
> +                                   package))
>
>   Operator messages
>  (defslimefn operator-arglist [name package]
> --
> 1.6.3.3.386.gfe2a5

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread Chouser

On Sun, Jul 5, 2009 at 3:51 PM, John Harrop wrote:
>
> This is frankly quite baffling. The changes to the function are
> innocent from a large-literal or pretty much any other perspective.

Both your functions load fine for me without the rest of
your code.  Are there type hints on the return values of any
of the functions called in your examples?

--Chouser

--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Adding type hint causes compiler error

2009-07-06 Thread philip.hazel...@gmail.com

On Jul 6, 12:25 pm, Jarkko Oranen  wrote:
> (ints nil) might also work

It does indeed. This seems to be as good a solution as could be hoped
for, thank you.
--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Adding type hint causes compiler error

2009-07-06 Thread Jarkko Oranen



On Jul 6, 1:26 pm, "philip.hazel...@gmail.com"
 wrote:
> On Jul 5, 10:31 pm, Mark Triggs  wrote:
>
> > (defn bi-get-pixels
> >   [#^BufferedImage bi]
> >   (let [raster (.getData bi)
> >         pixels (.getPixels raster 0 0 (.getWidth bi) (.getHeight bi)
> >                            (cast (Class/forName "[I") nil))]
> >     (vec pixels)))
>
> This still generates a single reflection warning, but #^ints before
> the cast fixes it. That gave me an idea:
>
> (defn bi-get-pixels
>   [#^BufferedImage bi]
>   (vec (.. bi (getData)
>            (getPixels 0 0 (.getWidth bi) (.getHeight bi)
>                       #^ints (identity nil)
>
> Which does the right thing with no warnings.
>
> Thanks for the help,
>
> -Phil

(ints nil) might also work
--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Adding type hint causes compiler error

2009-07-06 Thread philip.hazel...@gmail.com

On Jul 5, 10:31 pm, Mark Triggs  wrote:
> (defn bi-get-pixels
>   [#^BufferedImage bi]
>   (let [raster (.getData bi)
>         pixels (.getPixels raster 0 0 (.getWidth bi) (.getHeight bi)
>                            (cast (Class/forName "[I") nil))]
>     (vec pixels)))

This still generates a single reflection warning, but #^ints before
the cast fixes it. That gave me an idea:

(defn bi-get-pixels
  [#^BufferedImage bi]
  (vec (.. bi (getData)
   (getPixels 0 0 (.getWidth bi) (.getHeight bi)
  #^ints (identity nil)

Which does the right thing with no warnings.

Thanks for the help,

-Phil

>
> Cheers,
>
> Mark
>
> On Jul 5, 10:18 pm, "philip.hazel...@gmail.com"
>
>  wrote:
> > Hi,
>
> > The following code works as expected:
>
> > (import 'javax.imageio.ImageIO 'java.io.File
> > 'java.awt.image.BufferedImage)
> > (defn bi-get-pixels
> >   [bi]
> >   (vec (.. bi (getData) (getPixels 0 0 (.getWidth bi) (.getHeight bi)
> > nil
> > (bi-get-pixels (. ImageIO read (File. "/home/phil/prog/small-
> > test.png")))
>
> > But if *warn-on-reflection* is true, it generates four warnings. If we
> > try to shut it up with a type hint:
>
> > (defn bi-get-pixels
> >   [#^BufferedImage bi]
> >   (vec (.. bi (getData) (getPixels 0 0 (.getWidth bi) (.getHeight bi)
> > nil
>
> > Exception in thread "main" java.lang.IllegalArgumentException: More
> > than one matching method found: getPixels (imagio-test.clj:7)
> >         at clojure.lang.Compiler.analyzeSeq(Compiler.java:4558)
> > ...
> > Caused by: java.lang.IllegalArgumentException: More than one matching
> > method found: getPixels
> >         at clojure.lang.Compiler.getMatchingParams(Compiler.java:2122)
> >         at clojure.lang.Compiler$InstanceMethodExpr.
> > (Compiler.java:1159)
> >         at clojure.lang.Compiler$HostExpr$Parser.parse(Compiler.java:
> > 810)
> >         at clojure.lang.Compiler.analyzeSeq(Compiler.java:4551)
> >         ... 34 more
>
> > The problem here is that getPixels has three forms: 
> > (http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/Raster.html)
> >  double[]       getPixels(int x, int y, int w, int h, double[] dArray)
> >           Returns a double array containing all samples for a
> > rectangle of pixels, one sample per array element.
> >  float[]        getPixels(int x, int y, int w, int h, float[] fArray)
> >           Returns a float array containing all samples for a rectangle
> > of pixels, one sample per array element.
> >  int[]  getPixels(int x, int y, int w, int h, int[] iArray)
> >           Returns an int array containing all samples for a rectangle
> > of pixels, one sample per array element.
>
> > In each case, if the final argument is NULL it is ignored, and if not
> > the array is populated with the return data from the call (generating
> > an error if it's not large enough).
>
> > Is it possible to specify which invocation of getPixels I intend
> > without passing an array? I've tried putting #^ints in some likely-
> > looking places, but nil can't be type-hinted and the others seem to
> > have no effect. I've also tried splitting the .. up:
>
> > (defn bi-get-pixels
> >   [#^BufferedImage bi]
> >   (let [rast (.getData bi)
> >         #^ints pi (.getPixels rast 0 0 (.getWidth bi) (.getHeight bi) nil)]
> >     pi))
>
> > But this doesn't work either. I could do manual reflection on Raster
> > to get the correct method and .invoke it, but that seems far more
> > complicated than necessary. Any other ideas?
>
> > -Phil
>
>
--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: tests involving threads

2009-07-06 Thread Jarkko Oranen



On Jul 6, 7:51 am, Timothy Pratley  wrote:
> Very glad that test is now part of clojure core.
>
> I've run into 2 strange behaviours when trying to write tests where
> threads are involved. My case is a little complex so here is a minimal
> version which shows what I mean:
>
> test-test.clj:
> (ns test-test
>   (:use clojure.test))
>
> (deftest testathon
>   (let [f1 (future (is (= 1 2)))
>         f2 (future (future (/ 1 0)))]
>     @f1
>     @f2))
>
> (run-tests)
> (shutdown-agents)
>
> $ clj test-test.clj
>
> Testing test-test
>
> FAIL in clojure.lang.persistentlist$emptyl...@1 (test-test.clj:5)
> expected: (= 1 2)
>   actual: (not (= 1 2))
>
> Ran 1 tests containing 0 assertions.
> 0 failures, 0 errors.
>
> f1 failed, and a FAIL message is printed, but the end report indicates
> 0 failures.
> f2 raised an exception silently.
>
> I guess I'm just not "doing it right"!
>

Are you sure you don't want to test something like
(let [v (future (+ 1 2))]
  (is (= @v 3)))
instead? My guess is that having 'is inside a future messes up the per-
thread bindings that clojure.test uses. I don't know if there's a way
around that, but also doubt assertions inside futures are really
useful.

> Regards,
> Tim.

--
Jarkko
--~--~-~--~~~---~--~~
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---