20080329 Release

10 views
Skip to first unread message

Rich Hickey

unread,
Mar 29, 2008, 6:54:17 PM3/29/08
to Clojure
http://clojure.sourceforge.net/news/20080329_release.html

Many new features, including anonymous fn reader syntax, functional
tree zippers, streamlined documentation and metadata in defn/defmacro,
first-class sets and set algebra, proxies that can extend classes,
comprehensive in-source documentation, and many new library functions.
Not all of the new functionality has documentation in the prose part
of the site yet, but the new API doc page should be comprehensive.

There is some renaming/removing in this release:

removed implement, use proxy
renamed set to ref-set
renamed ! to send
renamed select to select-keys
renamed to-set to set
renamed scan to dorun
renamed touch to doall

Thanks to all for your feedback and support!

Rich

jon

unread,
Mar 29, 2008, 8:49:16 PM3/29/08
to Clojure
Thanks for the release.. did you notice the slight weirdness on
http://clojure.sourceforge.net/reference/api.html ?
Cheers, Jon

(defmacro [name doc-string? attr-map? <vector: - 1 items> body])
(defmacro [name doc-string? attr-map?
clojure.lang.PersistentList@eca3a4fe + attr-map?])
Macro

(defn [name doc-string? attr-map? <vector: - 1 items> body])
(defn [name doc-string? attr-map? clojure.lang.PersistentList@eca3a4fe
+ attr-map?])
Macro

Rich Hickey

unread,
Mar 29, 2008, 8:57:46 PM3/29/08
to Clojure
Fixed - thanks.

Rich

jon

unread,
Mar 29, 2008, 9:42:45 PM3/29/08
to Clojure
In inspector.clj, it looks like there's a redundant 2nd definition of
addTreeModelListener (?)

(defn tree-model [data]
(proxy [TreeModel] []
(getRoot [] data)
(addTreeModelListener [treeModelListener])
(getChild [parent index]
(get-child parent index))
(getChildCount [parent]
(get-child-count parent))
(isLeaf [node]
(is-leaf node))
(valueForPathChanged [path newValue])
(getIndexOfChild [parent child]
-1)
(addTreeModelListener [treeModelListener])
(removeTreeModelListener [treeModelListener])))

Robert Feldt

unread,
Mar 30, 2008, 5:27:00 AM3/30/08
to Clojure
Lots of great updates in this release, thanks Rich! Anonymous fn
reader syntax really increases brevity.

I'm really enjoying my Clojure experience so far!

Regards,

Robert

zork...@hotmail.com

unread,
Mar 30, 2008, 9:20:54 AM3/30/08
to Clojure
On Mar 30, 12:54 am, Rich Hickey <richhic...@gmail.com> wrote:
When I execute this code "(inspect-tree {:a 1 :b 2 :c [1 2 3 {:d 4 :e
5 :f [6 7 8]}]})" at the bottom of inspector.clj I get an error
message. This code on the other hand "(inspect-table [[1 2 3][4 5 6][7
8 9][10 11 12]])" works.

java.lang.NoSuchMethodError: clojure.lang.RT.entryString(Ljava/lang/
Object;Ljava/lang/Object;)Ljava/lang/String;
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor4.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at clojure.lang.Reflector.invokeConstructor(Reflector.java:128)
at clojure.fns.inspector.inspect_tree__2260.invoke(inspector.clj:90)
at clojure.lang.AFn.applyToHelper(AFn.java:183)
at clojure.lang.AFn.applyTo(AFn.java:174)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:2376)
at clojure.lang.Compiler.eval(Compiler.java:3385)
at clojure.lang.Repl.main(Repl.java:75)
Caused by: java.lang.NoSuchMethodError:
clojure.lang.RT.entryString(Ljava/lang/Object;Ljava/lang/Object;)Ljava/
lang/String;
at clojure.lang.PersistentHashMap
$LeafNode.toString(PersistentHashMap.java:491)
at javax.swing.JTree.convertValueToText(Unknown Source)
at
javax.swing.tree.DefaultTreeCellRenderer.getTreeCellRendererComponent(Unknown
Source)
at javax.swing.plaf.basic.BasicTreeUI
$NodeDimensionsHandler.getNodeDimensions(Unknown Source)
at javax.swing.tree.AbstractLayoutCache.getNodeDimensions(Unknown
Source)
at javax.swing.tree.VariableHeightLayoutCache
$TreeStateNode.updatePreferredSize(Unknown Source)
at javax.swing.tree.VariableHeightLayoutCache
$TreeStateNode.expand(Unknown Source)
at javax.swing.tree.VariableHeightLayoutCache
$TreeStateNode.expand(Unknown Source)
at javax.swing.tree.VariableHeightLayoutCache.rebuild(Unknown Source)
at javax.swing.tree.VariableHeightLayoutCache.setModel(Unknown
Source)
at javax.swing.plaf.basic.BasicTreeUI.setModel(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI$Handler.propertyChange(Unknown
Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown
Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown
Source)
at java.awt.Component.firePropertyChange(Unknown Source)
at javax.swing.JTree.setModel(Unknown Source)
at javax.swing.JTree.<init>(Unknown Source)
... 10 more

Phil Jordan

unread,
Mar 30, 2008, 9:24:17 AM3/30/08
to clo...@googlegroups.com
Hi,

Clojure n00b here, but very impressed so far.

Rich Hickey wrote:
> There is some renaming/removing in this release:
>
> removed implement, use proxy

I just tried the new version and failed to adjust some of my code to the
changes. Specifically, I can't seem to implement java.util.Comparator
anymore for (sorted-map-by ).

I used to have:

(def compare-range
(implement [java.util.Comparator]
(compare [a b]
(stuff a b)) ; actually more complex...
(equals [a]
(= a compare-range))))

Which, as far as I can tell, should now be:

(def compare-range
(proxy [java.util.Comparator] []
(compare [a b]
(stuff a b)) ; actually more complex...
(equals [a]
(= a this))))

Which gets me:
java.lang.ClassFormatError: Duplicate method name&signature in class
file clojure/lang/Proxy__<ID>

I've reduced it to a trivial test for the REPL:

user=> (proxy [Object java.util.Comparator] []
(compare [a b] (if (< a b) -1 (if (> a b) 1 0))))
java.lang.ClassFormatError: Duplicate method name&signature in class
file clojure/lang/Proxy__1066
java.lang.ClassFormatError: Duplicate method name&signature in class
file clojure/lang/Proxy__1066
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at
clojure.lang.DynamicClassLoader.defineClass(DynamicClassLoader.java:33)
at clojure.fns.clojure.get_proxy_class__783.doInvoke(proxy.clj:187)
at clojure.lang.RestFn.invoke(RestFn.java:426)
at clojure.fns.user.fn__1465.invoke(Unknown Source)
at clojure.lang.AFn.applyToHelper(AFn.java:181)


at clojure.lang.AFn.applyTo(AFn.java:174)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:2376)
at clojure.lang.Compiler.eval(Compiler.java:3385)
at clojure.lang.Repl.main(Repl.java:75)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jline.ConsoleRunner.main(ConsoleRunner.java:69)


However,

user=> (proxy [Object] []
(compare [a b] (if (< a b) -1 (if (> a b) 1 0))))
clojure.lang.Proxy__1464@11c19919

Seems to work fine.


Not specifying Object explicitly, like

user=> (proxy [java.util.Comparator] []
(compare [a b] (if (< a b) -1 (if (> a b) 1 0))))

produces identical results to being explicit.


What am I doing wrong? Or might this be a bug?

Thanks!

~phil

Rich Hickey

unread,
Mar 30, 2008, 9:52:46 AM3/30/08
to Clojure


On Mar 29, 9:42 pm, jon <superuser...@googlemail.com> wrote:
> In inspector.clj, it looks like there's a redundant 2nd definition of
> addTreeModelListener (?)
>
> (defn tree-model [data]

Fixed - thanks for the report.

Rich

Rich Hickey

unread,
Mar 30, 2008, 9:56:16 AM3/30/08
to Clojure


On Mar 30, 9:20 am, "zorkz...@hotmail.com" <zorkz...@hotmail.com>
wrote:

> When I execute this code "(inspect-tree {:a 1 :b 2 :c [1 2 3 {:d 4 :e
> 5 :f [6 7 8]}]})" at the bottom of inspector.clj I get an error
> message. This code on the other hand "(inspect-table [[1 2 3][4 5 6][7
> 8 9][10 11 12]])" works.
>
> java.lang.NoSuchMethodError: clojure.lang.RT.entryString(Ljava/lang/

Looks like you might not have a coherent build - that's an old
function no longer present and no longer referenced. Try clean, then
build.

Rich

Rich Hickey

unread,
Mar 30, 2008, 10:05:44 AM3/30/08
to Clojure


On Mar 30, 9:24 am, Phil Jordan <li...@philjordan.eu> wrote:
> Hi,
>
> Clojure n00b here, but very impressed so far.
>
> Rich Hickey wrote:
> > There is some renaming/removing in this release:
>
> > removed implement, use proxy
>
> I just tried the new version and failed to adjust some of my code to the
> changes. Specifically, I can't seem to implement java.util.Comparator
> anymore for (sorted-map-by ).
>
> I used to have:
>
> (def compare-range
> (implement [java.util.Comparator]
> (compare [a b]
> (stuff a b)) ; actually more complex...
> (equals [a]
> (= a compare-range))))

> What am I doing wrong? Or might this be a bug?
>

I'll look into it. Until then, you (and everyone) should be aware that
fns implement Comparator, so if you write a fn that takes 2 args and
returns -1/0/1 you are good to go:

(instance? java.util.Comparator stuff)
-> true

I should probably doc that...

Rich

Phil Jordan

unread,
Mar 30, 2008, 10:13:30 AM3/30/08
to clo...@googlegroups.com
Rich Hickey wrote:
> I'll look into it. Until then, you (and everyone) should be aware that
> fns implement Comparator, so if you write a fn that takes 2 args and
> returns -1/0/1 you are good to go:
>
> (instance? java.util.Comparator stuff)
> -> true

Oh, fantastic. That works great and makes stuff somewhat simpler.

> I should probably doc that...

Probably. In retrospect it seems an obvious thing to try, of course. :)

I'm not quite at the stage where I'm reading the Clojure source yet.
Getting there...

Thanks for the quick response!

~phil

Rich Hickey

unread,
Mar 30, 2008, 10:21:42 AM3/30/08
to Clojure


On Mar 30, 10:13 am, Phil Jordan <li...@philjordan.eu> wrote:
> Rich Hickey wrote:
> > I'll look into it. Until then, you (and everyone) should be aware that
> > fns implement Comparator, so if you write a fn that takes 2 args and
> > returns -1/0/1 you are good to go:
>
> > (instance? java.util.Comparator stuff)
> > -> true
>
> Oh, fantastic. That works great and makes stuff somewhat simpler.
>
> > I should probably doc that...
>
> Probably. In retrospect it seems an obvious thing to try, of course. :)
>

The doc is there now, at the end of the fn entry:

http://clojure.sourceforge.net/reference/special_forms.html

Rich

Rich Hickey

unread,
Mar 30, 2008, 4:00:55 PM3/30/08
to Clojure
Fixed - was a problem with interfaces that redeclare Object methods.

Thanks for the report,

Rich

puzzler

unread,
Mar 30, 2008, 7:15:00 PM3/30/08
to Clojure
My two cents: I liked scan and touch better than the new names.

Cool stuff! Can't wait to have an integrated editor/interactive loop/
debugger so I can play around with this.

Rich Hickey

unread,
Mar 30, 2008, 7:27:28 PM3/30/08
to Clojure


On Mar 30, 7:15 pm, puzzler <mark.engelb...@gmail.com> wrote:
> My two cents: I liked scan and touch better than the new names.
>

Fair enough. I'm trying to have all of the utilities related to side
effects begin with do.

Rich
Reply all
Reply to author
Forward
0 new messages