Change of wiki policy?

2008-11-19 Thread Meikel Brandmeyer

Hi,

was there a change to the wikibook policy I missed?

Suddenly I cannot edit the wiki anymore, because
every change has to approved by an "authorized"
user, whoever that may be.

Is this intended (eg. because of spam) or is that a
change of wikibooks itself, impacting in particular the
Clojure wiki?

Sincerely
Meikel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Trying to get the ants demo to run on Windows

2008-11-19 Thread mb

Hi,

there were some breaking changes in the SVN head lately
in preparation of v1.0. Rich updated the ants demo some
days, ago. So maybe you now have the new demo with the
"old" clojure. I got the demo working without problems before
the changes.

Sincerely
Meikel

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: i'm having a lot of trouble dealing with events.

2008-11-19 Thread notallama

well, it has changed quite a lot now: (i'm not sure if this all
actually works yet. they key map does, though)

;;gui imports. hurray!
(import
 '(javax.swing JFrame)
 '(java.awt  Canvas)
 '(java.awt.event KeyListener KeyEvent
  MouseListener MouseEcent
  FocusListener FocusEvent))

(defstruct window :win :canvas :buffer :keys-down :clicks)

(defn make-win
"makes a window, complete with canvas, backbuffer, key map, and click
map.
 maps are cleared when the window loses appropriate focus."
  [x y]
  (let [win (JFrame.)
canvas (Canvas.)
keys-down (agent {})
clicks (agent {})]
(doto canvas
  (setSize x y)
  (addKeyListener (proxy [KeyListener] []
(keyTyped [#^KeyEvent e] nil)
(keyPressed [#^KeyEvent e] (send keys-down assoc (. e 
getKeyCode)
e))
(keyReleased [#^KeyEvent e] (send keys-down dissoc (. e
getKeyCode)
  (addMouseListener (proxy [MouseListener] []
  (mousePressed [#^MouseEvent e] (send clicks assoc (. 
e getButton)
e))
  (mousereleased [#^MouseEvent e] (send clicks dissoc 
(. e
getButton)))
  (mouseExited [#^MouseEvent e] (send clicks (fn [a] 
{})))
  (mouseEntered [#^MouseEvent e])
  (mouseClicked [#^MouseEvent e])))
  (addFocusListener (proxy [FocusListener] []
  (FocusGained [#^FocusEvent e])
  (FocusLost [#^FocusEvent e] (send keys-down (fn [a] 
{}))
(doto win
  (setIgnoreRepaint true)
  (setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
  (add canvas)
  (pack)
  (setVisible true))
(doto canvas
  (createBufferStrategy 2))
(struct window win canvas (. canvas getBufferStrategy) keys-down
clicks)))



i think this is what i had when i first got it working error-free,
though: (this works, i just don't know for sure if it's what i had)

(import
 '(javax.swing JFrame)
 '(java.awt  Canvas)
 '(java.awt.event KeyListener KeyEvent))

(def app (JFrame.))
(def canvas
 (proxy [Canvas KeyListener] []
   (keyPressed [e] (println "hay! it's working!"))
   (keyReleased [e] (println "released"))
   (keyTyped [e] (println "typed"

(doto canvas
  (setFocusable true)
  (addKeyListener canvas))

(doto app
  (add canvas)
  (setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
  (setSize 640 480)
  (setVisible true))


without the keyReleased and keyTyped, it throws a bunch of errors.
in between the errors, it was printing stuff, though.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: i'm having a lot of trouble dealing with events.

2008-11-19 Thread Timothy Pratley

Would you mind posting your working version?
I tried your code with the keyPressed changed, but I get an exception
whenever I press a key
Exception in thread "AWT-EventQueue-0" java.io.IOException: Stream
closed
so something else must have changed also?

On Nov 20, 3:21 pm, notallama <[EMAIL PROTECTED]> wrote:
> figured it out.
>
> my prints were going to the inferior lisp buffer.
>
> i feel kinda silly now.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Bug + Patch: compile fails for namespaces with dashes in their names.

2008-11-19 Thread Chouser
Since SVN rev 1110:

user=> (compile 'clojure.contrib.str-utils)
java.lang.Exception: Namespace name must match file, had:
clojure.contrib.str-utils and clojure/contrib/str_utils.clj
(NO_SOURCE_FILE:0)

I think the only problem is that the test to generate this exception
asserts that classnames equal namespace names.  I think the actual
convention is meant to be that namespaces can have dashes, but the
generated classes will have underscores in their place.  The attached
patch fixes the assertion.

With this fix I can compile, and then without the .clj sources in the
classpath anymore, load the generated .class files.

--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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---

commit 7946422ff14968673b82e58ffd181f417355ddf1
Author: Chouser <[EMAIL PROTECTED]>
Date:   Thu Nov 20 00:11:12 2008 -0500

compile failed for namespaces with dashes in their names.  Fixed.

diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java
index 01f3c27..d3c4559 100644
--- a/src/jvm/clojure/lang/Compiler.java
+++ b/src/jvm/clojure/lang/Compiler.java
@@ -4498,7 +4498,7 @@ public static Object compile(Reader rdr, String sourcePath, String sourceName) t
 			{
 			Keyword gk = Keyword.intern(null, "gen-class");
 			Symbol nssym = (Symbol) RT.second(r);
-			if(!nssym.toString().equals(classname))
+			if(!nssym.toString().replace('-','_').equals(classname))
 throw new Exception(String.format("Namespace name must match file, had: %s and %s",
   nssym, sourcePath));
 			for(ISeq s = RT.rest(RT.rest(r)); s != null; s = s.rest())


Re: i'm having a lot of trouble dealing with events.

2008-11-19 Thread notallama

figured it out.

my prints were going to the inferior lisp buffer.

i feel kinda silly now.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: (Newbie) Multimethod dispatch by a function other than isa?

2008-11-19 Thread Chouser

On Wed, Nov 19, 2008 at 6:15 PM, samppi <[EMAIL PROTECTED]> wrote:
>
> I'm just wondering—is there a way to match methods' dispatch-values
> using a function other than isa?—such as with a macro.

This came up on IRC last week:

http://clojure-log.n01se.net/date/2008-11-14.html#17:40a-17:52

--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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: i'm having a lot of trouble dealing with events.

2008-11-19 Thread notallama

so i made a typo.
KeyPressed should be keyPressed

still nothing, though. tried making the listener seperate, adding it
to the frame, making the frame implement KeyListener and adding
itself. nothing.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



i'm having a lot of trouble dealing with events.

2008-11-19 Thread notallama

so, for a key listener, the keypressed method is called when you press
a key, right?
or am i misunderstanding how events work?

this is what i have:

(import
 '(javax.swing JFrame)
 '(java.awt  Canvas)
 '(java.awt.event KeyListener KeyEvent))

(def app (JFrame.))
(def canvas
 (proxy [Canvas KeyListener] []
   (KeyPressed [e] (print "hay! it's working!"

(doto canvas
  (setFocusable true)
  (addKeyListener canvas))

(doto app
  (add canvas)
  (setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
  (setSize 640 480)
  (setVisible true))


what i want it to do is print a message whenever a key is pressed, but
it doesn't.
(well, assuming that's how events are supposed to work.
the eventual plan is to have it so that when a key is pressed, it
calls a multimethod to deal with some refs. but it seems that i have
no idea what i'm doing here)

the window shows up, but key presses do nothing. (or nothing visible
in the frame or in the repl (slime), anyway)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Reclaiming scan and touch

2008-11-19 Thread Rich Hickey



On Nov 19, 6:51 pm, mifrai <[EMAIL PROTECTED]> wrote:
> I know it's minor and nit-picky but so long as we're rolling out so
> many breaking changes is it possible to reclaim scan and touch instead
> of leaving dead functions that need an :exclude?

Yes, done.

Rich
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: writing binary values (bytes) to a file

2008-11-19 Thread Jeff Bester

Not sure if this will help with what you are working on.  I ran across
a similar problem last week and ended up writing a generic library
that converts various sizes of integers to big or little endian byte
arrays and then back again.

Code is located at: 
http://github.com/jbester/cljext/tree/master/cljext%2Fbinpack.clj

Jeffrey

On Nov 19, 3:45 pm, prhlava <[EMAIL PROTECTED]> wrote:
> Hello again,
>
> Thank you all for the posts and explanations,
>
> After getting the clojure SVN version and few tweaks in the code, the
> working result looks like:
>
>                      (with-open [ofile (new java.io.FileOutputStream
>                                         (str result-directory
>                                              "/"
>                                              (make-filename x y))
>                                         (boolean true))] ; I am appending only
>                                 (. ofile write
>                               (into-array Byte/TYPE
>                                           [(byte (bit-shift-right pix 16))
>                                            (byte (bit-shift-right pix 8))
>                                            (byte pix)])) ; the pix is of the 
> Integer type
>
> Vlad

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Reclaiming scan and touch

2008-11-19 Thread mifrai

I know it's minor and nit-picky but so long as we're rolling out so
many breaking changes is it possible to reclaim scan and touch instead
of leaving dead functions that need an :exclude?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Bug + Patch: LazilyPersistentVector mutated by sort

2008-11-19 Thread Rich Hickey



On Nov 19, 8:23 pm, Chouser <[EMAIL PROTECTED]> wrote:
> _Jordan_ in IRC discovered a bug that can be distilled to:
>
> user=> (let [x [3 2 1]] (sort x) x)
> [1 2 3]
>
> The sort function mutates the vector.  This can happen because the
> toArray() method of LazilyPersistenVector returns its own internal
> array, instead of creating a new array like most other collections do.
>  sort then passes this along to Java's Arrays.sort() which mutates the
> array.
>
> Attached is a patch that makes LPV toArray() return a clone of the
> array.  This is of course somewhat less efficient, but it seems like
> any less drastic solution leaves open the possibility of mutating the
> array inside the vector.
>

Patch applied (rev 1114) - thanks!

Rich

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Bug + Patch: LazilyPersistentVector mutated by sort

2008-11-19 Thread Chouser
_Jordan_ in IRC discovered a bug that can be distilled to:

user=> (let [x [3 2 1]] (sort x) x)
[1 2 3]

The sort function mutates the vector.  This can happen because the
toArray() method of LazilyPersistenVector returns its own internal
array, instead of creating a new array like most other collections do.
 sort then passes this along to Java's Arrays.sort() which mutates the
array.

Attached is a patch that makes LPV toArray() return a clone of the
array.  This is of course somewhat less efficient, but it seems like
any less drastic solution leaves open the possibility of mutating the
array inside the vector.

--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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---

commit 28112e0208dea4374e6515240d8653d2a9af0caa
Author: Chouser <[EMAIL PROTECTED]>
Date:   Wed Nov 19 20:17:48 2008 -0500

LazilyPersistentVector.toArray() now returns clone of array to prevent accidental mutation.

diff --git a/src/jvm/clojure/lang/LazilyPersistentVector.java b/src/jvm/clojure/lang/LazilyPersistentVector.java
index bbe580f..455ea42 100644
--- a/src/jvm/clojure/lang/LazilyPersistentVector.java
+++ b/src/jvm/clojure/lang/LazilyPersistentVector.java
@@ -35,7 +35,7 @@ LazilyPersistentVector(IPersistentMap meta, Object[] array, PersistentVector v){
 }
 
 public Object[] toArray(){
-	return array;
+	return array.clone();
 }
 
 public Object nth(int i){


(Newbie) Multimethod dispatch by a function other than isa?

2008-11-19 Thread samppi

I'm just wondering—is there a way to match methods' dispatch-values
using a function other than isa?—such as with a macro. This is what
I'm thinking of:

  (defmulti foo identity #(re-find %2 %1)) ; uses the last function
instead of isa? to match

  (defmethod foo #"xyzzy" [x]
x))

  (defmethod foo #"plugh" [x]
(str x "!"))

  (defmulti bar identity #(%1 %2)) ; uses the last function to match

  (defmethod #(apply distinct? %) [x]
x))

  (defmethod (fn [x] (some #(> % 3) x)) [x]
(conj x 1 3))

  (foo "arstninixyzzy") ; matches the first method, returns
"arstninixyzzy"
  (foo "arstplughars") ; matches the second method, returns
"arstplughars!"
  (foo "arststr") ; does not match anything, raises error

  (bar [3 2 5]) ; matches the first method, returns [3 2 5]
  (bar [2 3 5 3]) ; matches the second method, returns [2 3 5 3 1 3]
  (bar [1 2 0 2]) ; matches nothing, raises error

This may not an important enough feature to support in the core; I'm
just thinking it may come useful in the future, and so am wondering if
it's possible with a macro.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: [SOLVED] writing binary values (bytes) to a file

2008-11-19 Thread Mark Volkmann

Thanks Stu! I wasn't aware of the meta function. That helps a lot!

I looked for occurrences of "(meta " throughout the clojure and
clojure-contrib repositories, but I didn't find a function that prints
the code for a given function. That would be incredibly useful for
learning! Does anybody know what function does that and whether it is
part of clojure-contrib?

On Wed, Nov 19, 2008 at 4:09 PM, Stuart Halloway
<[EMAIL PROTECTED]> wrote:
>
> Hi Mark,
>
> The metadata points to the source:
>
> user> (meta #'with-open)
> {:doc "bindings => name init\n\n  Evaluates body in a try expression
> with name bound to the value of\n  init, and a finally clause that
> calls (.close name).", :ns #, :arglists
> ([bindings & body]), :file "core.clj", :name with-open, :macro
> true, :line 1752}
>
> If you look through the archive I believe somebody posted code that
> uses the metadata to locate the source and display it at the REPL.
>
> Stu
>
>>
>> On Wed, Nov 19, 2008 at 2:45 PM, prhlava <[EMAIL PROTECTED]>
>> wrote:
>>>
>>>
>>> Hello again,
>>>
>>> Thank you all for the posts and explanations,
>>>
>>> After getting the clojure SVN version and few tweaks in the code, the
>>> working result looks like:
>>>
>>>(with-open [ofile (new java.io.FileOutputStream
>>>   (str result-directory
>>>"/"
>>>(make-filename x y))
>>>   (boolean true))] ; I am
>>> appending only
>>>   (. ofile write
>>> (into-array Byte/TYPE
>>> [(byte (bit-shift-right pix
>>> 16))
>>>  (byte (bit-shift-right pix
>>> 8))
>>>  (byte pix)])) ; the pix is
>>> of the Integer type
>>
>> It looks like with-open accepts any number of bindings. Does it just
>> call close on the first one when the body finishes or on all of them?
>>
>> If I wanted to figure this out for myself, how would I find the source
>> code for with-open?
>>
>> --
>> R. Mark Volkmann
>> Object Computing, Inc.
>>
>> >
>
>
> >
>



-- 
R. Mark Volkmann
Object Computing, Inc.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: [SOLVED] writing binary values (bytes) to a file

2008-11-19 Thread Graham Fawcett

On Wed, Nov 19, 2008 at 4:49 PM, Mark Volkmann
<[EMAIL PROTECTED]> wrote:
>
> On Wed, Nov 19, 2008 at 2:45 PM, prhlava <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hello again,
>>
>> Thank you all for the posts and explanations,
>>
>> After getting the clojure SVN version and few tweaks in the code, the
>> working result looks like:
>>
>> (with-open [ofile (new java.io.FileOutputStream
>>(str result-directory
>> "/"
>> (make-filename x y))
>>(boolean true))] ; I am appending only
>>(. ofile write
>>  (into-array Byte/TYPE
>>  [(byte (bit-shift-right pix 16))
>>   (byte (bit-shift-right pix 8))
>>   (byte pix)])) ; the pix is of the 
>> Integer type
>
> It looks like with-open accepts any number of bindings. Does it just
> call close on the first one when the body finishes or on all of them?
>
> If I wanted to figure this out for myself, how would I find the source
> code for with-open?

Hi,

If you're using Slime in Emacs, type in the word "with-open" (or put
your cursor on it in a Clojure source file) and press M-. (alt-period
or Escape, period).

Best,
Graham

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: [BUG?] No matching method found: getString

2008-11-19 Thread Chouser

On Wed, Nov 19, 2008 at 4:00 AM, Michael Wood <[EMAIL PROTECTED]> wrote:
>
> Exception in thread "main" java.lang.IllegalArgumentException: No
> matching method found: getString for class
> org.dcm4che2.data.BasicDicomObject (dinfo.clj:0)

This was discussed on IRC:

http://clojure-log.n01se.net/date/2008-11-19.html#15:46a-16:07

So it looks like there may be no good, general, solution.  Unless or
until there is, there's a work-around using reflection manually.

Start by getting a reference to the Method you're trying to call:

(def bdo-get-string (.getMethod (identity BasicDicomObject)
"getString" (into-array [Integer/TYPE])))

The three args to .getMethods are:
1. The class (use identity to get the instance of Class instead of
trying to BasicDicomObject's non-existent getMethod method)
2. The name of the method as a string, "getString"
3. An array of the argument types for the method you want to call.
Use Interger/TYPE to specify the primitive 'int'

You can then call the method you found above using the .invoke method
of the Method instance:

(.invoke bdo-get-string (BasicDicomObject.) (to-array [0x00100010]))

The .invoke method always takes 3 args:
1. The Method instance we got earlier
2. The instance of the class you want call (in this example I created
a new instance on the spot)
3. And array holding all the args to pass to the Method.

Not too pretty, but of course if you find you actually need this you
can wrap either step in a function to make calling it more pleasant.

--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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Trying to get the ants demo to run on Windows

2008-11-19 Thread Rob Hansford

Hi all,
I'm new to clojure and I've just been trying to get the ants demo from
the video lectures to work.  I presume I've done something wrong
because I get a screen full of errors when I load in the ants.clj file
(pasted below).  I tried copying and pasting the code in bit by bit
(if I paste too much in one go I get errors), and the errors come from
the definition of setup (lines 58 to 70).  I also get errors from the
definition of panel (lines 283 to 287) which I've also pasted below.
Can anyone tell me what I've done wrong?  I got clojure from the
sourceforge .zip file download, and I installed the Java 6 update 10
JDK from the link on the 'getting started' page, and I'm running it
from a cmd prompt on windows XP SP2.

Thanks

Rob.

=

D:\Downloads\clojure\clojure_20080916>java -cp clojure.jar
clojure.lang.Repl
Clojure
user=> (load-file "../ants.clj")
java.lang.IllegalArgumentException: recur arg for primitive local:
G__2315 must
be matching primitive
clojure.lang.Compiler$CompilerException: ants.clj:61:
java.lang.IllegalArgumentE
xception: recur arg for primitive local: G__2315 must be matching
primitive
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3865)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3848)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyze(Compiler.java:3671)
at clojure.lang.Compiler.access$100(Compiler.java:37)
at clojure.lang.Compiler$HostExpr$Parser.parse(Compiler.java:
734)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3858)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3848)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyze(Compiler.java:3671)
at clojure.lang.Compiler.access$100(Compiler.java:37)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:
3384)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:3231)
at clojure.lang.Compiler$FnMethod.access$1200(Compiler.java:
3142)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2766)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3856)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3848)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.access$200(Compiler.java:37)
at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:
343)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3858)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3848)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyze(Compiler.java:3671)
at clojure.lang.Compiler.eval(Compiler.java:3895)
at clojure.lang.Compiler.load(Compiler.java:4196)
at clojure.lang.Compiler.loadFile(Compiler.java:4163)
at clojure.lang.RT$3.invoke(RT.java:289)
at user.eval__2290.invoke(Unknown Source)
at clojure.lang.Compiler.eval(Compiler.java:3891)
at clojure.lang.Repl.main(Repl.java:75)
Caused by: java.lang.RuntimeException:
java.lang.IllegalArgumentException: recur
 arg for primitive local: G__2315 must be matching primitive
at clojure.lang.Compiler$RecurExpr.emit(Compiler.java:3598)
at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3414)
at clojure.lang.Compiler$IfExpr.emit(Compiler.java:2264)
at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3414)
at clojure.lang.Compiler$LetExpr.emit(Compiler.java:3542)
at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3414)
at clojure.lang.Compiler$LetExpr.emit(Compiler.java:3534)
at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3414)
at clojure.lang.Compiler$LetExpr.emit(Compiler.java:3542)
at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3414)
at clojure.lang.Compiler$LetExpr.emit(Compiler.java:3542)
at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3411)
at clojure.lang.Compiler$FnMethod.emit(Compiler.java:3255)
at clojure.lang.Compiler$FnExpr.compile(Compiler.java:3013)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2807)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3856)
... 34 more
Caused by: java.lang.IllegalArgumentException: recur arg for primitive
local: G_
_2315 must be matching primitive
at clojure.lang.Compiler$RecurExpr.emit(Compiler.java:3593)
... 49 more
user=>

==

user=>
(def panel (doto (proxy [JPanel] []
(paint [g] (render g)))
 (.setPreferredSize (n

ants.clj: question about sleep in dosync

2008-11-19 Thread Stephan Mühlstrasser

Hi,

first of all hello to everybody as I'm new to this group.

I'm starting to learn Clojure, and therefore I studied the ants.clj
program. It's more or less clear to me how it works, but I stumbled
across a small detail that made me wonder.

In the "behave" function for the ant agent, there's the "(. Thread
(sleep ant-sleep-ms))" inside the dosync transaction block. The sleep
time is pretty short, but doesn't sleeping inside a dosync increase
the probability that transactions must be restarted? Would it be
better to put the sleep immediately before the dosync block, or
doesn't it matter?

Thanks
Stephan

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: [SOLVED] writing binary values (bytes) to a file

2008-11-19 Thread Stuart Halloway

Hi Mark,

The metadata points to the source:

user> (meta #'with-open)
{:doc "bindings => name init\n\n  Evaluates body in a try expression  
with name bound to the value of\n  init, and a finally clause that  
calls (.close name).", :ns #, :arglists  
([bindings & body]), :file "core.clj", :name with-open, :macro  
true, :line 1752}

If you look through the archive I believe somebody posted code that  
uses the metadata to locate the source and display it at the REPL.

Stu

>
> On Wed, Nov 19, 2008 at 2:45 PM, prhlava <[EMAIL PROTECTED]>  
> wrote:
>>
>>
>> Hello again,
>>
>> Thank you all for the posts and explanations,
>>
>> After getting the clojure SVN version and few tweaks in the code, the
>> working result looks like:
>>
>>(with-open [ofile (new java.io.FileOutputStream
>>   (str result-directory
>>"/"
>>(make-filename x y))
>>   (boolean true))] ; I am  
>> appending only
>>   (. ofile write
>> (into-array Byte/TYPE
>> [(byte (bit-shift-right pix  
>> 16))
>>  (byte (bit-shift-right pix  
>> 8))
>>  (byte pix)])) ; the pix is  
>> of the Integer type
>
> It looks like with-open accepts any number of bindings. Does it just
> call close on the first one when the body finishes or on all of them?
>
> If I wanted to figure this out for myself, how would I find the source
> code for with-open?
>
> -- 
> R. Mark Volkmann
> Object Computing, Inc.
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: [SOLVED] writing binary values (bytes) to a file

2008-11-19 Thread Mark Volkmann

On Wed, Nov 19, 2008 at 2:45 PM, prhlava <[EMAIL PROTECTED]> wrote:
>
>
> Hello again,
>
> Thank you all for the posts and explanations,
>
> After getting the clojure SVN version and few tweaks in the code, the
> working result looks like:
>
> (with-open [ofile (new java.io.FileOutputStream
>(str result-directory
> "/"
> (make-filename x y))
>(boolean true))] ; I am appending only
>(. ofile write
>  (into-array Byte/TYPE
>  [(byte (bit-shift-right pix 16))
>   (byte (bit-shift-right pix 8))
>   (byte pix)])) ; the pix is of the 
> Integer type

It looks like with-open accepts any number of bindings. Does it just
call close on the first one when the body finishes or on all of them?

If I wanted to figure this out for myself, how would I find the source
code for with-open?

-- 
R. Mark Volkmann
Object Computing, Inc.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: pattern matching in function parameters

2008-11-19 Thread J. McConnell

On Wed, Nov 19, 2008 at 4:16 PM, Mark Volkmann
<[EMAIL PROTECTED]> wrote:
>
> I'm reading an excellent article on functional programming at
> http://www.defmacro.org/ramblings/fp.html. Toward the end there is a
> section on pattern matching. They give the following example which
> uses a fictional, Java-like syntax. Can Clojure do something like this
> where the fib function is overloaded using "patterns" instead of
> arity?
>
> int fib(0) { return 1; }
>
> int fib(1) { return 1; }
>
> int fib(int n) {
>return fib(n - 2) + fib(n - 1);
> }

I don't believe Clojure supports this, no, though it has been brought
up before and I seem to recall somebody working on something. However,
this example can implemented using multimethods:

user=> (defmulti fib int)
#'user/fib
user=> (defmethod fib 0 [_] 1)
#
user=> (defmethod fib 1 [_] 1)
#
user=> (defmethod fib :default [n] (+ (fib (- n 2)) (fib (- n 1
#
user=> (map fib (range 10))
(1 1 2 3 5 8 13 21 34 55)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: pattern matching in function parameters

2008-11-19 Thread Kevin Downey

(defmulti fib (fn [x] x) :default)
(defmethod fib 0 [x] 0)
(defmethod fib 1 [x] 1)
(defmethod fib :default [n] (+ (fib (- n 2)) (fib (- n 1

seems to do the trick.

On Wed, Nov 19, 2008 at 1:25 PM, Kyle R. Burton <[EMAIL PROTECTED]> wrote:
>
> I have no idea how much effort it would be, but I've found the common
> lisp pcond library to be useful for pattern matching and a few other
> use cases:
>
>  http://www.cliki.net/pcond
>
> I'd also like to see support for value based as well as structural
> shape based pattern matching.
>
>
> Regards,
>
> Kyle
>
> On Wed, Nov 19, 2008 at 4:16 PM, Mark Volkmann
> <[EMAIL PROTECTED]> wrote:
>>
>> I'm reading an excellent article on functional programming at
>> http://www.defmacro.org/ramblings/fp.html. Toward the end there is a
>> section on pattern matching. They give the following example which
>> uses a fictional, Java-like syntax. Can Clojure do something like this
>> where the fib function is overloaded using "patterns" instead of
>> arity?
>>
>> int fib(0) { return 1; }
>>
>> int fib(1) { return 1; }
>>
>> int fib(int n) {
>>return fib(n - 2) + fib(n - 1);
>> }
>>
>> --
>> R. Mark Volkmann
>> Object Computing, Inc.
>>
>> >
>>
>
>
>
> --
> --
> Wisdom and Compassion are inseparable.
>-- Christmas Humphreys
> [EMAIL PROTECTED]http://asymmetrical-view.com/
> --
>
> >
>



-- 
The Mafia way is that we pursue larger goals under the guise of
personal relationships.
Fisheye

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: pattern matching in function parameters

2008-11-19 Thread Kyle R. Burton

I have no idea how much effort it would be, but I've found the common
lisp pcond library to be useful for pattern matching and a few other
use cases:

  http://www.cliki.net/pcond

I'd also like to see support for value based as well as structural
shape based pattern matching.


Regards,

Kyle

On Wed, Nov 19, 2008 at 4:16 PM, Mark Volkmann
<[EMAIL PROTECTED]> wrote:
>
> I'm reading an excellent article on functional programming at
> http://www.defmacro.org/ramblings/fp.html. Toward the end there is a
> section on pattern matching. They give the following example which
> uses a fictional, Java-like syntax. Can Clojure do something like this
> where the fib function is overloaded using "patterns" instead of
> arity?
>
> int fib(0) { return 1; }
>
> int fib(1) { return 1; }
>
> int fib(int n) {
>return fib(n - 2) + fib(n - 1);
> }
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
> >
>



-- 
--
Wisdom and Compassion are inseparable.
-- Christmas Humphreys
[EMAIL PROTECTED]http://asymmetrical-view.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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



pattern matching in function parameters

2008-11-19 Thread Mark Volkmann

I'm reading an excellent article on functional programming at
http://www.defmacro.org/ramblings/fp.html. Toward the end there is a
section on pattern matching. They give the following example which
uses a fictional, Java-like syntax. Can Clojure do something like this
where the fib function is overloaded using "patterns" instead of
arity?

int fib(0) { return 1; }

int fib(1) { return 1; }

int fib(int n) {
return fib(n - 2) + fib(n - 1);
}

-- 
R. Mark Volkmann
Object Computing, Inc.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: multimethods + derive question

2008-11-19 Thread Rich Hickey



On Nov 19, 2:35 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> Rich,
>
> Very helpful, as always. Alias + the ability to pull in symbols names
> via refer was exactly what I was looking for.
>
> One scenario still worries me:
>
> 1. I create a multimethod that dispatches around a tag whose value is
> an unresolved keyword (:Foo instead of ::Foo). Everything works fine.
>
> 2. If at some later point I want the dispatch to depend on (derive),
> it is breaking change for clients to switch to from :Foo  to ::Foo.
>
> I am tempted to conclude that you should never use unqualified
> keywords as type tags, because you are exposing an implementation
> detail. That is, the implementation promises not to rely on derive.
>

Agreed. Qualified keywords or symbols as :tag values makes sense,
independent of derive, as many people will be using :tag, you can't
assert that you alone own the tag :Foo.

Rich
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: offtopic - where are you come from? (poll)

2008-11-19 Thread tak

Scottsdale, Arizona (USA)

On Oct 17, 2:27 am, "Rastislav Kassak" <[EMAIL PROTECTED]> wrote:
> Hello Clojurians,
>
> I think after 1st year of Clojure life it's good to check how far has
> Clojure spread all over the world.
>
> So wherever areyoucomefrom, be proud and say it.
>
> I'm from Slovakia. :)
>
> RK

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: clojure slime

2008-11-19 Thread Matt Revelle

I also made updates to support the doto change, if git is easier for  
you then pull from git://github.com/mattrepl/swank-clojure.git

-Matt

On Nov 19, 2008, at 1:30 PM, Stephen C. Gilardi wrote:

> On Nov 19, 2008, at 1:15 PM, Mike Hinchey wrote:
>> Clojure svn 1110 does work with latest swank-clojure.
>>
>> But, svn  (doto) breaks swank again.
>
> I've enclosed a patch. Patch with:
>
> cd swank-clojure
> patch -p1 < swank-clojure-doto.patch
>
> --Steve
>
> 
>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: [SOLVED] writing binary values (bytes) to a file

2008-11-19 Thread prhlava


Hello again,

Thank you all for the posts and explanations,

After getting the clojure SVN version and few tweaks in the code, the
working result looks like:

 (with-open [ofile (new java.io.FileOutputStream
(str result-directory
 "/"
 (make-filename x y))
(boolean true))] ; I am appending only
(. ofile write
  (into-array Byte/TYPE
  [(byte (bit-shift-right pix 16))
   (byte (bit-shift-right pix 8))
   (byte pix)])) ; the pix is of the 
Integer type

Vlad


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: multimethods + derive question

2008-11-19 Thread Stuart Halloway

Rich,

Very helpful, as always. Alias + the ability to pull in symbols names  
via refer was exactly what I was looking for.

One scenario still worries me:

1. I create a multimethod that dispatches around a tag whose value is  
an unresolved keyword (:Foo instead of ::Foo). Everything works fine.

2. If at some later point I want the dispatch to depend on (derive),  
it is breaking change for clients to switch to from :Foo  to ::Foo.

I am tempted to conclude that you should never use unqualified  
keywords as type tags, because you are exposing an implementation  
detail. That is, the implementation promises not to rely on derive.

Cheers,
Stuart


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: writing binary values (bytes) to a file

2008-11-19 Thread Graham Fawcett

Hi,

> Dealing with byte-arrays, you will want to use the write-method that
> takes an array, not the one that takes a string.
>
> Constructing the array is a bit tricky:
>
> ; Define your int
> (def pix 652187261)
>
> ; Define your array, typed as array of char
> (def payload
>  (into-array Character/TYPE [(char (bit-shift-right pix 16))
>  (char (bit-shift-right pix 8))
>  (char pix)]))

Char's on the JVM are not bytes, and are wider than 8 bits -- so if
you're packing binary data, you should use Byte and byte instead of
Character and char. (Note too that the pix value is greater than 2^24,
so you need four bytes to store it if you're using a byte-array.)

As wwmorgan mentioned, FileOutputStreams can write out byte-buffers,
so the following seems to work:

; Define your int
(def pix 652187261)

; Define your array, typed as array of byte (not char!)
(def payload
(into-array Byte/TYPE [(byte (bit-shift-right pix 24))
   (byte (bit-shift-right pix 16))
   (byte (bit-shift-right pix 8))
   (byte pix)]))

; Create your FileWriter
(def ofile (java.io.FileOutputStream. "/tmp/somefile.bin2"))

; Write and close
(.write ofile payload)
(.close ofile)

The created file contains four bytes: 26 df 96 7d.

Bonus question for the bored reader: write a function,
(byte-array-maker N), that takes a width N, and returns a function
that takes an Integer as input and returns an N-width byte array
containing the Integer in big-endian order. E.g.

((byte-array-maker 4) 652187261)
=> [4-byte array: 26, df, 96, 7d]

Cheers,
Graham

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Global debug variables

2008-11-19 Thread J . Pablo Fernández

Hello,

While using clojure.contrib.sql I find many times that I am not
generating good SQL (like when doing create-table with bad arguments).
I'd like to add a debugging mode for clojure.contrib.sql, that when
enable, it would cause it to print the statements or something like
that. Is there any global debug variables that I could use or maybe a
package-wide debug variable or what do you recommend?

Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Is this boolean behavior intentional?

2008-11-19 Thread Raffael Cavallaro



On Nov 19, 2:21 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> Fixed (svn 1112) - thanks for the report.
>
> The problem is that the Java reflection APIs return new Boolean values
> other than the canonic Boolean.TRUE and Boolean.FALSE when boxing
> booleans, but for efficiency only canonic false is logical false in
> Clojure. Apparently, Array.get also falls into this category, so I had
> to fix up all Boolean returns from Array.get
>
> Rich

Ah, I thought it might have something to do with the boxing. Thanks
for looking into this so quickly.

warmest regards,


Ralph
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: writing binary values (bytes) to a file

2008-11-19 Thread wwmorgan

In general, Writers are for character data and OutputStreams are for
binary data. If possible, create a FileOutputStream like this:

(ns my.ns
  (:import (java.io FileOutputStream)))

(def ofile (FileOutputStream. "/some/file/somewhere"))

and use one of the write methods of FileOutputStream.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Is this boolean behavior intentional?

2008-11-19 Thread Rich Hickey



On Nov 19, 1:12 pm, Raffael Cavallaro <[EMAIL PROTECTED]>
wrote:
> user> (def test-array (make-array (. Boolean TYPE) 100))
> #'user/test-array
> user> (aget test-array 0)
> false
> user> (= (aget test-array 0) false)
> true
> user> (if (aget test-array 0) 'true-value 'false-value)
> true-value
>
> Same issue with when, and when-not as well. IOW, (aget some-boolean-
> array some-index) is treated as returning true even if the actual
> return value of aget is false.

Fixed (svn 1112) - thanks for the report.

The problem is that the Java reflection APIs return new Boolean values
other than the canonic Boolean.TRUE and Boolean.FALSE when boxing
booleans, but for efficiency only canonic false is logical false in
Clojure. Apparently, Array.get also falls into this category, so I had
to fix up all Boolean returns from Array.get

Rich

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Namespaces and distinctness

2008-11-19 Thread verec

> The reason why is the first part of your domain is
> unimportant and possibly likely to change.

Much in the same way we have:

java.lang.Math

... and ...

com.sun.awt.AWTUtilites, or, even "better":

com.sun.org.apache.*

:-) :-) :-) :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Dividing by zero and floating-point infinity

2008-11-19 Thread samppi

I am not familiar with how Java's arithmetic works, but it seems from
http://hanuska.blogspot.com/2007/08/arithmeticexception-vs-nan.html
and http://www.concentric.net/~Ttwang/tech/javafloat.htm that dividing
a double or float by 0 should result in positive or negative infinity
(like Double.POSITIVE_INFINITY) or NaN (e.g. Double.NaN). But doing so
in Clojure always throws an ArithmeticException. Is this different
from Java's behavior? Is it possible to get positive or negative
infinity from division in Clojure?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: offtopic - where are you come from? (poll)

2008-11-19 Thread bigler

Chicago, IL - USA

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: writing binary values (bytes) to a file

2008-11-19 Thread pmf

On Nov 19, 5:51 pm, prhlava <[EMAIL PROTECTED]> wrote:
> (. ofile write (str
>                                            (char (bit-shift-right pix 16))
>                                            (char (bit-shift-right pix 8))
>                                            (char pix)))
>                            )
>

Dealing with byte-arrays, you will want to use the write-method that
takes an array, not the one that takes a string.

Constructing the array is a bit tricky:

; Define your int
(def pix 652187261)

; Define your array, typed as array of char
(def payload
  (into-array Character/TYPE [(char (bit-shift-right pix 16))
  (char (bit-shift-right pix 8))
  (char pix)]))

; Create your FileWriter
(def ofile (java.io.FileWriter. "somefile.bin"))

; Write and close
(.write ofile payload)
(.close ofile)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: clojure slime

2008-11-19 Thread Stephen C. Gilardi
On Nov 19, 2008, at 1:15 PM, Mike Hinchey wrote:Clojure svn 1110 does work with latest swank-clojure.But, svn  (doto) breaks swank again.I've enclosed a patch. Patch with:cd swank-clojurepatch -p1 < swank-clojure-doto.patch--Steve


swank-clojure-doto.patch
Description: Binary data



Re: clojure slime

2008-11-19 Thread Mike Hinchey
Clojure svn 1110 does work with latest swank-clojure.

But, svn  (doto) breaks swank again.

user=> java.lang.Exception: Unable to resolve symbol: start in this context
(thread.clj:10)
user=> java.lang.Exception: No such var: swank/ignore-protocol-version
(NO_SOURCE_FILE:5)
user=> java.lang.Exception: No such var: swank/start-server
(NO_SOURCE_FILE:7)

-Mike

On Tue, Nov 18, 2008 at 10:35 PM, Jeffrey Chu <[EMAIL PROTECTED]> wrote:

>
> Sorry for the inconvenience. It's been fixed. - Jeff
>
> On Nov 18, 5:41 pm, islon <[EMAIL PROTECTED]> wrote:
> > I'll not use slime right now (thanks Bill).
> > swank-clojure will be fixed anytime soon?
> >
> > On Nov 18, 11:15 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote:
> >
> > > SVN version 1110 of Clojure made a breaking change to a feature that
> > > swank-clojure is using. For now, I recommend moving back one rev by
> > > using:
> >
> > > svn up -r 1109
> >
> > > from within your checkout of clojure/trunk.
> >
> > > In the past, Jeff has updated swank-clojure very quickly on those rare
>
> > > occasions where Clojure changes enough to break it. Stay tuned.
> >
> > > --Steve
> >
> > > On Nov 18, 2008, at 8:01 PM, islon wrote:
> >
> > > > I checkouted the last clojure from svn, swank-clojure and
> clojure-mode
> > > > too.
> > > > When I start slime it give me the following errors:
> >
> > > > Clojure
> > > > user=> (add-classpath "file:home/islon/opt/swank-clojure/")
> > > > nil
> > > > user=>
> > > > (require (quote swank))
> > > > java.lang.Exception: No such var: swank.util/gen-and-load-class
> > > > (core.clj:39)
> > > > user=>
> > > > (swank/ignore-protocol-version "2008-11-02")
> > > > java.lang.Exception: No such var: swank/ignore-protocol-version
> > > > (NO_SOURCE_FILE:5)
> > > > user=>
> > > > (swank/start-server "/tmp/slime.22694" :encoding "iso-latin-1-unix")
> > > > java.lang.Exception: No such var: swank/start-server (NO_SOURCE_FILE:
> > > > 7)
> > > > user=>
> >
> > > > It worked until I update clojure from svn.
> > > > Any ideas?
> >
> > > > Regards.
> >
> >
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Is this boolean behavior intentional?

2008-11-19 Thread Raffael Cavallaro

user> (def test-array (make-array (. Boolean TYPE) 100))
#'user/test-array
user> (aget test-array 0)
false
user> (= (aget test-array 0) false)
true
user> (if (aget test-array 0) 'true-value 'false-value)
true-value

Same issue with when, and when-not as well. IOW, (aget some-boolean-
array some-index) is treated as returning true even if the actual
return value of aget is false.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure in MathRider (an easy way for newbies to experiment with Clojure code)

2008-11-19 Thread Ted Kosan

Paul wrote:

> This looks very interesting but when I try to execute clojure code (either
> from the editor or the REPL) I get the following error:
>
> "Could not initialize class clojure.lang.RT"

I will contact you off list to work on resolving the problem.

Thanks,

Ted

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: (Newbie) simple tack

2008-11-19 Thread Brian Doyle
I like this solution as well.  You have to pull in the seq-utils for the
indexed
function though.

(use 'clojure.contrib.seq-utils)

(defn nonzero-idxs [s]
   (for [[i n] (indexed s) :when (and n (not (zero? n)))] i))


On Wed, Nov 19, 2008 at 10:39 AM, Rich Hickey <[EMAIL PROTECTED]> wrote:

>
>
>
> On Nov 19, 11:18 am, capricorn20 <[EMAIL PROTECTED]> wrote:
> > I want create seq which keep indexes of non-zero elements of
> > collection.
> > Code:
> >
> > (defn nonzero-inx [s]
> >   (filter (fn [x] (not (nil? x))) (map (fn [a b] (if (not (== a 0))
> > b)) s (range (count s)
> >
> > look complicated than solution in most imperative languages.
> > May be possible simplest way in Clojure?
>
> You are on the right track, this a bit more succinct:
>
> (defn nonzero-idxs [s]
>  (remove nil?
>(map #(when-not (zero? %1) %2)
> s (iterate inc 0
>
> Rich
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Namespaces and distinctness

2008-11-19 Thread Paul Barry

I would prefer to see this not become a convention in Clojure.  The
reason why is the first part of your domain is unimportant and
possibly likely to change.  The hibernate project was a good example
of this.  They were first hosting it on sourceforge, so they made all
their packages net.sf.hibernate, but then they decided to host it
themselves and had to change everything to org.hibernate.  In both
cases, the net.sf. and the org. are unnecessary.  No one else is going
to create a project called hibernate, so just hibernate is enough.
Continuing with that, the packages that come with clojure itself are
clojure.core, clojure.xml, etc., not org.clojure.core,
org.clojure.xml.

On Nov 19, 3:53 am, mb <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On 19 Nov., 09:47, Simon Brooke <[EMAIL PROTECTED]> wrote:
>
> > Java has a simple and neat convention for achieving global namespace
> > distinctness without the overhead of a central registry - you just
> > reverse your domain name and append a bit. Is there a similar
> > convention for Clojure namespaces?
>
> Yes. This is the convention for Clojure. com.example.mylib.
>
> Sincerely
> Meikel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: (Newbie) simple tack

2008-11-19 Thread Rich Hickey



On Nov 19, 11:18 am, capricorn20 <[EMAIL PROTECTED]> wrote:
> I want create seq which keep indexes of non-zero elements of
> collection.
> Code:
>
> (defn nonzero-inx [s]
>   (filter (fn [x] (not (nil? x))) (map (fn [a b] (if (not (== a 0))
> b)) s (range (count s)
>
> look complicated than solution in most imperative languages.
> May be possible simplest way in Clojure?

You are on the right track, this a bit more succinct:

(defn nonzero-idxs [s]
  (remove nil?
(map #(when-not (zero? %1) %2)
 s (iterate inc 0

Rich
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: offtopic - where are you come from? (poll)

2008-11-19 Thread prhlava


> I'm from Slovakia. :)

I am from my mum who was in Slovakia at the time of my birth ;-) (and
I have grown up in Slovakia)

Vlad

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



writing binary values (bytes) to a file

2008-11-19 Thread prhlava


Hello all,

I have started to play with the clojure a day ago and today I have
almost finished porting simple program (from plt-scheme).

The place I got stuck in is - how to write a binary value (multiple
bytes) in one write operation to a file... The code uses
java.io.FileWriter, but this wants string.

What I need to write is 3 RHS bytes from an integer, (the pix is
Integer in following code):

(. ofile write (str
   (char (bit-shift-right pix 16))
   (char (bit-shift-right pix 8))
   (char pix)))
   )

writes wrong stuff. Is this unicode thing, my noob status thing or
something else?

Kind regards,

Vlad

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



(Newbie) simple tack

2008-11-19 Thread capricorn20

I want create seq which keep indexes of non-zero elements of
collection.
Code:

(defn nonzero-inx [s]
  (filter (fn [x] (not (nil? x))) (map (fn [a b] (if (not (== a 0))
b)) s (range (count s)

look complicated than solution in most imperative languages.
May be possible simplest way in Clojure?





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



clj-html: an HTML compilation library

2008-11-19 Thread Mark McGranaghan

Hi all,

I'm happy to release clj-html, an HTML compilation library.

clj-html tries to combine the functional interface and expressive
literal vector syntax of compojure's HTML library[1] with the
compilation model of cl-who[2]. The goal is to start with easy-to-read
and concise templates, process them aggressively at compile time, and
leave as little code as possible to execute at run-time.

For example:

(html
  [:body
[:div#content
  [:h1.greeting greeting]
  [:p.message message]]]))

; expands to:
(let* [html-builder (StringBuilder.)]
  (.append html-builder "")
  (if-let [content__148 greeting] (.append html-builder
content__148))
  (.append html-builder "")
  (if-let [content__148 message] (.append html-builder content__148))
  (.append html-builder "")
  (.toString html-builder))

; evaluates to (with greeting bound to "Hello" and message to "from
clj-html"):
"Hellofrom clj-html"

If clj-html sounds interesting to you, please check out the github
page:
http://github.com/mmcgrana/clj-html/tree/master

I've been using clj-html on an internal project recently, but this is
still very much alpha software. Comments and suggestions are welcome.

- Mark

[1] http://github.com/weavejester/compojure/tree/master
[2] http://www.weitz.de/cl-who/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Use of unprintable/readable values

2008-11-19 Thread Rich Hickey



On Nov 19, 10:07 am, Stuart Sierra <[EMAIL PROTECTED]>
wrote:
> Hmm, it seems strange to me that this works at all:
>
> user=> (eval '(list + 1 2 3))
> (# 1 2 3)
> user=> (eval *1)
> 6
>
> Does that mean that functions evaluate to themselves?
>

Sure, they always have (think map). The trick is, what happens when
you embed them in code, as the above does, or some macros would like
to do. In the early work towards AOT I wasn't able to serialize fns,
such serialization being necessary for putting constants in to
bytecode. I've relaxed that restriction for fns that are not closures
- they are now print-dup'able.

Rich

>
> On Nov 19, 9:01 am, "J. McConnell" <[EMAIL PROTECTED]> wrote:
>
> > In writing up tests for clojure.contrib.test-clojure that cover the
> > Evaluation page of clojure.org, I came across the fact that the
> > following threw a CompilerException due to a
> > "java.lang.ClassNotFoundException: clojure._PLUS___224":
>
> > (eval (eval '(list + 1 2 3)))
>
> > After the AOT changes, this no longer throws an exception and instead
> > produces what I had expected previously, the value 6. Is this
> > something that will be supported now, i.e. should I be testing to
> > ensure that the above form produces 6? My suspicion is yes, but I
> > wanted to check anyhow.
>
> > Thanks,
>
> > - J.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Modified doto

2008-11-19 Thread Rich Hickey



On Oct 23, 9:53 am, Rich Hickey <[EMAIL PROTECTED]> wrote:
> On Oct 21, 10:30 am, mb <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > On 21 Okt., 14:41, mb <[EMAIL PROTECTED]> wrote:> (defmacro doto->
>
> > The name is actually also up to discussion. doto is already
> > in use and this change is incompatible to "legacy" code.
> > I couldn't come up with a good alternative...
>
> I'd rather enhance doto to do this and not add another variant. The
> break would be that current (doto x (foo 42)) would have to become
> (doto x (.foo 42)).
>

Rev.  makes this (breaking) change, hopefully the last breakage
pre 1.0.

I've updated the ants.clj file here, and would appreciate it if people
could touch up the wiki and any other public demos.

Thanks,

Rich

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: performance of clojure.contrib.mmap

2008-11-19 Thread aim

Here's my second attempt.  I fixed one obvious bug but it was the
addition of the type "#^ByteBuffer" that made a *huge* difference.

The times now look something like:

 Compile file /home/aim/src/clojure/foo.clj ...
"Elapsed time: 64.273962 msecs"
"Elapsed time: 59.607317 msecs"
"Elapsed time: 61.639253 msecs"
"Elapsed time: 61.495916 msecs"
"Elapsed time: 61.805888 msecs"

(import '(java.io File))
(import '(java.nio ByteBuffer))
(import '(java.nio MappedByteBuffer))
(import '(clojure.contrib))
(import '(clojure.contrib.mmap))

(require 'clojure.contrib.mmap)

(def my-file (File. "/home/aim/largelog.bin"))
(def my-buff (mmap my-file))

(defn my-iterate-map [f #^ByteBuffer buf]
  (let [max (long (.length f))]
(.position buf 0)
(loop [i (long 1)]
  ;;(println i)
  (if (< i (long max))
(do
  (.get buf)
  (recur (unchecked-inc i))
  buf)

(dotimes [_ 5] (time (my-iterate-map my-file my-buff)))


On Nov 19, 1:14 pm, aim <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I was experimenting with using mmap from clojure but I see vastly
> different timings when compared to plain old Java and
> MappedByteBuffer.
>
> Here's my code and also represents the largest bit of clojure I have
> written:
>
>   (import '(java.io File))
>
>   (use 'clojure.contrib.mmap)
>
>   (def my-file (File. "/home/aim/largelog.bin"))
>
>   (defn my-iterate-map [buf]
>     (let [max (.remaining buf)]
>       (loop [i (long 1)]
>         (if (< i max)
>           (do (.get buf)
>               (recur (unchecked-inc i))
>     buf)
>
>   (time (my-iterate-map (mmap my-file)))
>
> The results I see from clojure are:
>
>    (time (my-iterate-map (mmap my-file))) ...
>   "Elapsed time: 113191.133057 msecs"
>
> But If I do the same thing in Java I get:
>
>   gone in 0.0540 seconds!
>
> Is there something I can do to make the clojure version near or
> equivalent to the java code below?
>
> Thanks,
> Andy.
>
> --- Java code --
>
> import java.io.File;
> import java.io.FileInputStream;
> import java.nio.ByteBuffer;
> import java.nio.channels.FileChannel;
>
> public class Main {
>         public static void main(String[] args) throws Exception {
>                 File f = new File(args[0]);
>                 FileInputStream fis = new FileInputStream(f);
>                 ByteBuffer buf = 
> fis.getChannel().map(FileChannel.MapMode.READ_ONLY,
> 0, f.length());
>                 long then = System.currentTimeMillis();
>                 long sum = 0;
>                 while (buf.hasRemaining()) {
>                         sum += (buf.get() & 0xFF);
>                 }
>                 long now = System.currentTimeMillis();
>                 System.out.printf("gone in %.4f seconds!\n", (((now - then) /
> 1000.0)));
>         }
>
> }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Use of unprintable/readable values

2008-11-19 Thread Stuart Sierra

Hmm, it seems strange to me that this works at all:

user=> (eval '(list + 1 2 3))
(# 1 2 3)
user=> (eval *1)
6

Does that mean that functions evaluate to themselves?

-Stuart Sierra


On Nov 19, 9:01 am, "J. McConnell" <[EMAIL PROTECTED]> wrote:
> In writing up tests for clojure.contrib.test-clojure that cover the
> Evaluation page of clojure.org, I came across the fact that the
> following threw a CompilerException due to a
> "java.lang.ClassNotFoundException: clojure._PLUS___224":
>
> (eval (eval '(list + 1 2 3)))
>
> After the AOT changes, this no longer throws an exception and instead
> produces what I had expected previously, the value 6. Is this
> something that will be supported now, i.e. should I be testing to
> ensure that the above form produces 6? My suspicion is yes, but I
> wanted to check anyhow.
>
> Thanks,
>
> - J.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Use of unprintable/readable values

2008-11-19 Thread J. McConnell

On Wed, Nov 19, 2008 at 10:01 AM, Rich Hickey <[EMAIL PROTECTED]> wrote:
> On Nov 19, 9:01 am, "J. McConnell" <[EMAIL PROTECTED]> wrote:
>>
>> (eval (eval '(list + 1 2 3)))
>>
>> should I be testing to
>> ensure that the above form produces 6? My suspicion is yes, but I
>> wanted to check anyhow.
>
> I've added support for non-closure fns as code, so yes.

Great, thanks Rich! Sorry for the confusing subject line ... I
realized half-way through composing the email that the unreadable
nature of the printed + had nothing to do with it, but I forgot to
change the subject :)

- J.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



performance of clojure.contrib.mmap

2008-11-19 Thread aim

Hi,

I was experimenting with using mmap from clojure but I see vastly
different timings when compared to plain old Java and
MappedByteBuffer.

Here's my code and also represents the largest bit of clojure I have
written:

  (import '(java.io File))

  (use 'clojure.contrib.mmap)

  (def my-file (File. "/home/aim/largelog.bin"))

  (defn my-iterate-map [buf]
(let [max (.remaining buf)]
  (loop [i (long 1)]
(if (< i max)
  (do (.get buf)
  (recur (unchecked-inc i))
buf)

  (time (my-iterate-map (mmap my-file)))

The results I see from clojure are:

   (time (my-iterate-map (mmap my-file))) ...
  "Elapsed time: 113191.133057 msecs"

But If I do the same thing in Java I get:

  gone in 0.0540 seconds!

Is there something I can do to make the clojure version near or
equivalent to the java code below?

Thanks,
Andy.

--- Java code --

import java.io.File;
import java.io.FileInputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

public class Main {
public static void main(String[] args) throws Exception {
File f = new File(args[0]);
FileInputStream fis = new FileInputStream(f);
ByteBuffer buf = 
fis.getChannel().map(FileChannel.MapMode.READ_ONLY,
0, f.length());
long then = System.currentTimeMillis();
long sum = 0;
while (buf.hasRemaining()) {
sum += (buf.get() & 0xFF);
}
long now = System.currentTimeMillis();
System.out.printf("gone in %.4f seconds!\n", (((now - then) /
1000.0)));
}
}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Use of unprintable/readable values

2008-11-19 Thread Rich Hickey



On Nov 19, 9:01 am, "J. McConnell" <[EMAIL PROTECTED]> wrote:
> In writing up tests for clojure.contrib.test-clojure that cover the
> Evaluation page of clojure.org, I came across the fact that the
> following threw a CompilerException due to a
> "java.lang.ClassNotFoundException: clojure._PLUS___224":
>
> (eval (eval '(list + 1 2 3)))
>
> After the AOT changes, this no longer throws an exception and instead
> produces what I had expected previously, the value 6. Is this
> something that will be supported now, i.e. should I be testing to
> ensure that the above form produces 6? My suspicion is yes, but I
> wanted to check anyhow.
>

I've added support for non-closure fns as code, so yes.

Rich


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: (Newbie) Are lexically-scoped methods possible?

2008-11-19 Thread samppi

Thanks to everyone who answered. The custom macro seems to be the way
to go for a local method. I'm no good at macros, though, so I suppose
I have to confront them and figure them out now. :)

On Nov 19, 5:20 am, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> You could write a with-method macro that adds a method to a  
> multifunction, and then removes it at the end of the test. It would be  
> dynamically scoped, but that should be good enough for test setup/
> teardown.
>
> Stuart
>
>
>
> > I'm trying to unit-test a library with which a user can define methods
> > on the library's multi-function to change its behavior. So I need to
> > be able to define lexically-scoped methods in each test. Is it
> > possible to use let to create a lexically-scoped method?
>
> > The problems I'm encountering are that, unlike for functions, there
> > doesn't seem to be a special-form for creating methods, and that even
> > if it could be defined it'd go in the current namespace instead of the
> > library's namespace. But does anyone know how I can test this anyway?
>
> > Thanks in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: multimethods + derive question

2008-11-19 Thread Rich Hickey



On Nov 19, 7:45 am, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am working on the multimethod chapter this week. This has required a
> lot of exploration, as the multimethod feature set goes well beyond
> what most people are using yet. I have hit one rough spot: derive. I
> have working code (below), but I don't like the way I have to call it
> with fully qualified keywords, e.g.
>
> (service-charge {:tag :examples.multimethods.service-charge-3/
> checking :balance 100})
> -> 25
> (service-charge {:tag :examples.multimethods.service-charge-3/
> checking :balance 1})
> -> 0
>
> I feel that I have made a wrong turn somewhere. Here are my assumptions:
>
> 1. I (the implementer) have to write my dispatch functions with
> qualified names, if I want to use derive.

Derive works only with qualified names for an important reason - so it
can be extensible without clashes. But it's important to logically
segregate hierarchical things from non, as namespace control is
orthogonal.

>
> 2. John Doe (the caller) must use fully qualified names *everywhere*.
> Since he does not live in my namespace he cannot use the ::.
>

Qualified names, yes, fully, no. In particular, :: supports aliases,
as shown below, or ` can be used with symbols.

> It's the latter that bothers me. It seems so ugly that I would never
> use hierarchical names for anything, which makes me think I am missing
> something. To make matters worse:
>
> 3. Once I use :: once on any keyword in my implementation, it is a
> quick slope to using it other places too, just so I don't have to
> remember which ones I chose to qualify and which ones I didn't. In the
> code below, :premium and :basic become ::premium and ::basic just for
> consistency with ::checking and ::savings.

Keywords are going to be used in different contexts for different
reasons, saying they should all use :: for consistency is sort of
punting on making decisions about their use.

>
> ---
> (ns examples.multimethods.service-charge-3)
>
> (defmulti account-level :tag)
> (println ::checking)
> (defmethod account-level ::checking [acct]
>(if (>= (:balance acct) 5000) ::premium ::basic))
> (defmethod account-level ::savings [acct]
>(if (>= (:balance acct) 1000) ::premium ::basic))
>
> (derive ::savings ::account)
> (derive ::checking ::account)
>
> (defmulti service-charge (fn [acct] [(account-level acct) (:tag acct)]))
> (defmethod service-charge [::basic ::checking]   [_] 25)
> (defmethod service-charge [::basic ::savings][_] 10)
> (defmethod service-charge [::premium ::account] [_] 0)

Here are two ways to do it that I would consider idiomatic, or at
least as intended. In both implementations, account tags are
hierarchical, and account levels are considered an enumeration,
account 'types' are capitalized. Consumer code uses normal namespace
management to deal with the names.

In the keyword version, note how you can use ::alias/name and get a
resolved keyword. In the symbol version note the consistent use of
syntax-quote, and the ability to pull in names using use/refer.

Other than the default resolution (symbols are resolved and keywords
aren't), they pretty much have parity here. In particular, note
symbols are functions of maps like keywords, a feature not used below
but important for their use as keys in maps.

;; using keywords ;;

(ns examples.multimethods.service-charge-3)

(defmulti account-level :tag)

(defmethod account-level ::Checking [acct]
   (if (>= (:balance acct) 5000) :premium :basic))
(defmethod account-level ::Savings [acct]
   (if (>= (:balance acct) 1000) :premium :basic))

(derive ::Savings ::Account)
(derive ::Checking ::Account)

(defmulti service-charge (fn [acct] [(account-level acct) (:tag
acct)]))
(defmethod service-charge [:basic ::Checking]   [_] 25)
(defmethod service-charge [:basic ::Savings][_] 10)
(defmethod service-charge [:premium ::Account] [_] 0)

(in-ns 'user)
(alias 'sc 'examples.multimethods.service-charge-3)

(sc/service-charge {:tag ::sc/Checking :balance 100})
(sc/service-charge {:tag ::sc/Checking :balance 1})


;; using symbols ;;

(ns examples.multimethods.service-charge-4)

(defmulti account-level :tag)
(defmethod account-level `Checking [acct]
   (if (>= (:balance acct) 5000) :premium :basic))
(defmethod account-level `Savings [acct]
   (if (>= (:balance acct) 1000) :premium :basic))

(declare Account Savings Checking)

(derive `Savings `Account)
(derive `Checking `Account)

(defmulti service-charge (fn [acct] [(account-level acct) (:tag
acct)]))
(defmethod service-charge [:basic `Checking]   [_] 25)
(defmethod service-charge [:basic `Savings][_] 10)
(defmethod service-charge [:premium `Account] [_] 0)


(in-ns 'user)
(refer 'examples.multimethods.service-charge-4)

(service-charge {:tag `Checking :balance 100})
(service-charge {:tag `Checking :balance 1})


Re: multimethods + derive question

2008-11-19 Thread mb

Hello stuart,

On 19 Nov., 13:45, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> I am working on the multimethod chapter this week. This has required a  
> lot of exploration, as the multimethod feature set goes well beyond  
> what most people are using yet. I have hit one rough spot: derive. I  
> have working code (below), but I don't like the way I have to call it  
> with fully qualified keywords, e.g.

I feel not very familiar with multimethods up to now. I don't know
whether I'm using them correctly or not. (So a good thing, that you
investigate this for your book. :))

So take my interpretation with a good deal of salt.

Multimethods define an interface. Suppose for example the harness
question for test-is.

(defmulti report-result )

Now the librarian provides a function make-fancy-harness. John Doe
just calls this function and gets something. In fact he shouldn't even
bother, what it looks like. The only thing he has to know is, that
report-result does the right thing, when it is fed with that
something.
If John Doe looks inside and starts using internal information, I hope
he ends up in rework hell.

Now suppose John wants to extend the library. Now that's a different
story. Now he has to use the fully qualified keyword. Exactly once.
In derive. Compare this to class Foo extends
fully.quallified.ClassName.
After this point, :: is sufficient. For Jim, user of John's library,
the
same argument as above applies.

So in an ideal world fully qualified keywords should never ever show
up in user code. Only the defining namespace should use them.

The problem between : and :: is something I don't quite understand.
Either it is local to your namespace. Then it doesn't matter. Or you
leak it outside. Then :: should be used to avoid clashes. It can be
even used as an indicator for a part of the API. ("Change this and
user code will break.")

Accessing a field directly was already a bad idea back when we all
used C. And it brings inflexibility. For example, a deriver(?) wants
to replace a field, with a dynamically computed value? With direct
access you are off, with an interface function it easily possible.

Sincerely
Meikel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Use of unprintable/readable values

2008-11-19 Thread J. McConnell

In writing up tests for clojure.contrib.test-clojure that cover the
Evaluation page of clojure.org, I came across the fact that the
following threw a CompilerException due to a
"java.lang.ClassNotFoundException: clojure._PLUS___224":

(eval (eval '(list + 1 2 3)))

After the AOT changes, this no longer throws an exception and instead
produces what I had expected previously, the value 6. Is this
something that will be supported now, i.e. should I be testing to
ensure that the above form produces 6? My suspicion is yes, but I
wanted to check anyhow.

Thanks,

- J.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Part 2 of my little Clojure tutorial is up

2008-11-19 Thread Vincent Foley

I am writing a small Clojure tutorial which tries to explore different
facets of the language, while still producing a semi-useful program.
I posted the second part on my blog yesterday.  Many thanks to Chouser
for proof-reading the document!

http://gnuvince.wordpress.com/2008/11/18/fetching-web-comics-with-clojure-part-2/

Cheers,

Vincent.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



multimethods + derive question

2008-11-19 Thread Stuart Halloway

Hi all,

I am working on the multimethod chapter this week. This has required a  
lot of exploration, as the multimethod feature set goes well beyond  
what most people are using yet. I have hit one rough spot: derive. I  
have working code (below), but I don't like the way I have to call it  
with fully qualified keywords, e.g.

(service-charge {:tag :examples.multimethods.service-charge-3/ 
checking :balance 100})
-> 25
(service-charge {:tag :examples.multimethods.service-charge-3/ 
checking :balance 1})
-> 0

I feel that I have made a wrong turn somewhere. Here are my assumptions:

1. I (the implementer) have to write my dispatch functions with  
qualified names, if I want to use derive.

2. John Doe (the caller) must use fully qualified names *everywhere*.  
Since he does not live in my namespace he cannot use the ::.

It's the latter that bothers me. It seems so ugly that I would never  
use hierarchical names for anything, which makes me think I am missing  
something. To make matters worse:

3. Once I use :: once on any keyword in my implementation, it is a  
quick slope to using it other places too, just so I don't have to  
remember which ones I chose to qualify and which ones I didn't. In the  
code below, :premium and :basic become ::premium and ::basic just for  
consistency with ::checking and ::savings.

Is anybody else working with derive? What are your experiences?

Thanks,
Stu

---
(ns examples.multimethods.service-charge-3)

(defmulti account-level :tag)
(println ::checking)
(defmethod account-level ::checking [acct]
   (if (>= (:balance acct) 5000) ::premium ::basic))
(defmethod account-level ::savings [acct]
   (if (>= (:balance acct) 1000) ::premium ::basic))

(derive ::savings ::account)
(derive ::checking ::account)

(defmulti service-charge (fn [acct] [(account-level acct) (:tag acct)]))
(defmethod service-charge [::basic ::checking]   [_] 25)
(defmethod service-charge [::basic ::savings][_] 10)
(defmethod service-charge [::premium ::account] [_] 0)






--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: (Newbie) Are lexically-scoped methods possible?

2008-11-19 Thread Stuart Halloway

In Clojure, specific implementations of a Clojure multimethod are  
called methods.

Cheers,
Stuart

> What do you mean by methods as distinct from functions? In clojure
> there are only functions. Are you referring to Java methods?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: (Newbie) Are lexically-scoped methods possible?

2008-11-19 Thread Stuart Halloway

You could write a with-method macro that adds a method to a  
multifunction, and then removes it at the end of the test. It would be  
dynamically scoped, but that should be good enough for test setup/ 
teardown.

Stuart
>
> I'm trying to unit-test a library with which a user can define methods
> on the library's multi-function to change its behavior. So I need to
> be able to define lexically-scoped methods in each test. Is it
> possible to use let to create a lexically-scoped method?
>
> The problems I'm encountering are that, unlike for functions, there
> doesn't seem to be a special-form for creating methods, and that even
> if it could be defined it'd go in the current namespace instead of the
> library's namespace. But does anyone know how I can test this anyway?
>
> Thanks in advance!
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure in MathRider (an easy way for newbies to experiment with Clojure code)

2008-11-19 Thread Paul Drummond
This looks very interesting but when I try to execute clojure code (either
from the editor or the REPL) I get the following error:

"Could not initialize class clojure.lang.RT"


2008/11/18 Ted Kosan <[EMAIL PROTECTED]>

>
> I am in the process of developing a mathematics-oriented IDE called
> MathRider and I have recently added Clojure to it.  One nice thing
> about MathRider is that it provides a way for Clojure newbies to
> quickly start experimenting with Clojure inside an IDE by downloading
> and extracting a single file.  I have included some small example
> Clojure programs in MathRider and I will be adding more in the future
> (if anyone has additional example programs they would like to see
> added to MathRider, send them to me and I will include them.)
>
> MathRider can be downloaded from:
>
>http://mathrider.org
>
> Ted Kosan
> ted.kosan at gmail.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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: offtopic - where are you come from? (poll)

2008-11-19 Thread liu chang

Singapore +1.

On Wed, Nov 19, 2008 at 5:24 PM, walterc <[EMAIL PROTECTED]> wrote:
>
> taipei, taiwan
>
> cheers,
>
> walter chang
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: offtopic - where are you come from? (poll)

2008-11-19 Thread Tim Wiess

Seattle, WA

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: POLL: Domain name for project hosting site.

2008-11-19 Thread Rastislav Kassak

I'm not native english speaker, so Clojury and Jewel doesn't sound
cute to me. :)
In Slovak we have very rich gramatical system for creating cute words,
even in more levels, so any word in its base form doesn't sound cute
to us.

So, I'm really sorry, I didn't mean it cute way.

On 11/18/08, Paul Drummond <[EMAIL PROTECTED]> wrote:
> At the risk of sounding like an old fart, I cringe when I hear "Clojury" and
> "Jewel" - they are too "cute" (as Rich nicely put it a while back -
> http://groups.google.com/group/clojure/msg/0351ca20c758b0b3).
>
> I agree with Brian Carper - we should keep it readable so +1 for something
> like "clojureforge" - but I don't really like that either if I'm honest.
>
> Just for the record, my own contribution would be "The Clojure Project
> Hosting Site" but even I will admit that is too boring ;)
>
> Paul
>
>
>
>
>
>
>  >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Working combination of .emacs, Aquamacs, swank-clojure, clojure-mode?

2008-11-19 Thread Asbjørn Bjørnstad



On Nov 19, 12:08 am, Matt Revelle <[EMAIL PROTECTED]> wrote:
> On Nov 18, 2008, at 9:42 AM, Raffael Cavallaro <[EMAIL PROTECTED]
> wrote:
> > As the old chestnut goes, one never gets a second chance to make a
> > first impression. The first impression one gets now does *not* reflect
> > the quality of clojure at this point. The first impression one gets
> > now is "OK, broken, check back later." Clojure is more mature than
> > this, and the initial setup brokenness is easily solved by putting up
> > an archive of working versions of the various components even if they
> > grow to be many months old before they're refreshed. This would not
> > require an automated testing server, just a single tar command line
> > once or twice a year.
>
> Sure, you're absolutely correct that more effort could have been made  
> to streamline Emacs/SLIME support for particular revisions of  
> Clojure.  But since Clojure is bleeding edge and Emacs/SLIME users are  
> usually tinkerers there hasn't been enough of a demand to warrant the  
> effort.  I expect this will change as soon as 1.0 is released.

It is already the case that Clojure has releases. If the getting
started page that talks about setting up slime just points to a
version of slime/swank that works with the latest release version of
Clojure, the problems with version mismatches should be reduced.

  -asbjxrn
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: offtopic - where are you come from? (poll)

2008-11-19 Thread walterc

taipei, taiwan

cheers,

walter chang
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: offtopic - where are you come from? (poll)

2008-11-19 Thread ivant

On Oct 17, 11:27 am, "Rastislav Kassak" <[EMAIL PROTECTED]> wrote:
> Hello Clojurians,
>
> So wherever are you come from, be proud and say it.

Sofia, Bulgaria
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



[BUG?] No matching method found: getString

2008-11-19 Thread Michael Wood

In September I was trying out the Java interop support of Clojure by
converting this:

http://www.dcm4che.org/confluence/display/d2/Accessing+dcm4che2+Toolkit+with+Jruby

to Clojure.

I was using the 20080612 release and got an exception like this:

Exception in thread "main" java.lang.IllegalArgumentException: No
matching method found: getString for class
org.dcm4che2.data.BasicDicomObject (dinfo.clj:0)

rhickey pointed out that there was a 20080916 version available, so I
tried that and the problem went away.

Yesterday I tried running the code again using r1109 of Clojure and
got the same exception again!  Here's what it looks like with r1110:

Exception in thread "main" java.lang.IllegalArgumentException: No
matching method found: getString for class
org.dcm4che2.data.BasicDicomObject (dinfo.clj:0)
at clojure.lang.Compiler.eval(Compiler.java:4111)
at clojure.lang.Compiler.load(Compiler.java:4427)
at clojure.lang.Compiler.loadFile(Compiler.java:4394)
at clojure.lang.Script.main(Script.java:65)
Caused by: java.lang.IllegalArgumentException: No matching method
found: getString for class org.dcm4che2.data.BasicDicomObject
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:48)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
at clojure.core$print_tag__8.invoke(dinfo.clj:18)
at clojure.core$eval__11.invoke(dinfo.clj:21)
at clojure.lang.Compiler.eval(Compiler.java:4100)
... 3 more

The code is here:
http://paste.lisp.org/display/70670

The Javadoc for BasicDicomObject is here:
http://www.dcm4che.org/docs/dcm4che2-apidocs/org/dcm4che2/data/BasicDicomObject.html

I bisected this down to r1047 and r1048.  i.e.:
1029 works
1039 works
1044 works
1046 works
1047 doesn't work
1049 doesn't work
1069 doesn't work
1109 doesn't work

If I revert those two revisions then the problem goes away again.
i.e. the following fixes it:
svn up -r1110; svn diff -r1046:1048 | patch -p0 -R

Chouser said, "Wodin: looks like you're going to have to take it up
with rhickey_. The method you want isBridge (whatever that means), but
the class is not StringBuilder, thus Clojure's not letting you get to
that method. "

-- 
Michael Wood <[EMAIL PROTECTED]>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Namespaces and distinctness

2008-11-19 Thread mb

Hi,

On 19 Nov., 09:47, Simon Brooke <[EMAIL PROTECTED]> wrote:
> Java has a simple and neat convention for achieving global namespace
> distinctness without the overhead of a central registry - you just
> reverse your domain name and append a bit. Is there a similar
> convention for Clojure namespaces?

Yes. This is the convention for Clojure. com.example.mylib.

Sincerely
Meikel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Namespaces and distinctness

2008-11-19 Thread Simon Brooke

Java has a simple and neat convention for achieving global namespace
distinctness without the overhead of a central registry - you just
reverse your domain name and append a bit. Is there a similar
convention for Clojure namespaces?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: General question, what are using for clojure?

2008-11-19 Thread mb

Hi,

the following thread was a poll for features, but also about what
people do
with Clojure.

http://groups.google.com/group/clojure/browse_thread/thread/7bf9257fea4a0c47/93c8e34baa18ca59?lnk=gst&q=POLL#93c8e34baa18ca59

Sincerely
Meikel

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: General question, what are using for clojure?

2008-11-19 Thread Boris Schmid

Three things:

* rewriting an agent-based hiv-evolution model that I am using in my
phd from ruby to clojure.
* learning a new (sensible - multicore compatible) programming
language to use as a postdoc
* (right now neglected, as I'm finishing my phd: building an agent-
based model to study the effect of different theories of consciousness
on the intelligence of those agents).

I worked in arc for a while before I realized that that language might
take another decade to evolve in a finished project, and then hopped
over to clojure, which seems to be far more ready.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---