Re: Latest clojure + contrib

2011-05-05 Thread Sean Corfield
On Thu, May 5, 2011 at 10:18 AM, Trastabuga wrote: > How do I get latest clojure and clojure-contrib? It depends on how bleeding edge you want to be. If you want to try the most recent monolithic contrib build, you could depend on these: [org.clojure/clojure "1.3.0-alpha4"] [org.clojure.contrib

Re: Eval destroys equality

2011-05-05 Thread Ken Wesson
On Thu, May 5, 2011 at 4:41 PM, Alan wrote: > Right. But if I drop all references to the returned function after I'm > done with it, it gets GCed. If there's some class holding a reference > to it forever, it will never get cleaned up. For example, ((fnmaker4 > (range)) 1e6) will (I think?) curren

Re: Eval destroys equality

2011-05-05 Thread Jonathan Fischer Friberg
Although (as I just realized), it fails miserably with closures. On Thu, May 5, 2011 at 11:38 PM, Jonathan Fischer Friberg < odysso...@gmail.com> wrote: > I created a new datatype to solve this problem: > http://gist.github.com/958001 > c-fn creates a comparable function; > > (let [fnmaker4 (fn [

Re: Eval destroys equality

2011-05-05 Thread Jonathan Fischer Friberg
I created a new datatype to solve this problem: http://gist.github.com/958001 c-fn creates a comparable function; (let [fnmaker4 (fn [coll] (c-fn [n] (nth coll n))) ints (range)] (= (fnmaker4 ints) (fnmaker4 ints))) => true On Thu, May 5, 2011 at 10:41 PM, Alan wrote: > On May 5, 1:

Re: Eval destroys equality

2011-05-05 Thread Alan
On May 5, 1:28 pm, Ken Wesson wrote: > On Thu, May 5, 2011 at 4:16 PM, Alan wrote: > > (let [fnmaker4 (fn [coll] (fn [n] (nth coll n))) > >      ints (range)] > >  (= (fnmaker4 ints) (fnmaker4 ints))) > > > You want to make it impossible to compare functions that close over > > infinite sequences

Re: Eval destroys equality

2011-05-05 Thread Ken Wesson
On Thu, May 5, 2011 at 4:16 PM, Alan wrote: > (let [fnmaker4 (fn [coll] (fn [n] (nth coll n))) >      ints (range)] >  (= (fnmaker4 ints) (fnmaker4 ints))) > > You want to make it impossible to compare functions that close over > infinite sequences? What is the point of being able to compare > fun

Re: Closures in macros

2011-05-05 Thread Ken Wesson
On Wed, May 4, 2011 at 8:01 PM, Ken Wesson wrote: > Note that instantiating the class with 4 gives us an add-4-to function > instead of the original add-3-to function here. To actually convert > that particular closure into code that reproduces it, the array of > constructor arguments needs to be

Re: Eval destroys equality

2011-05-05 Thread Alan
(let [fnmaker4 (fn [coll] (fn [n] (nth coll n))) ints (range)] (= (fnmaker4 ints) (fnmaker4 ints))) You want to make it impossible to compare functions that close over infinite sequences? What is the point of being able to compare functions if there are cases in which using the functions w

Re: Eval destroys equality

2011-05-05 Thread Ken Wesson
This is another case of function-object evaluation acting hinky, actually. Specifically, (eval (id 7)) is evaluating a list of (id 7), not ('id 7). As near as I can figure out, rather than embed the function object reference into the code OR complain, it is creating a new instance of its class wit

Re: Latest clojure + contrib

2011-05-05 Thread Stuart Sierra
Not all of the new contrib libs have been released yet. For the ones that have been released, you can find the .jar files here: http://repo2.maven.org/maven2/org/clojure/ -Stuart S clojure.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To pos

Latest clojure + contrib

2011-05-05 Thread Trastabuga
Hi How do I get latest clojure and clojure-contrib? I understand now there is no a single contrib lib, but if you go to http://dev.clojure.org/display/design/Contrib+Projects and click on xml project you'll an empty git project. I tried to use clojre + contrib 1.2 but it lacks support for javax.xm

ANN: Jark 0.3 (using the nrepl protocol)

2011-05-05 Thread isaac praveen
Hi, It is a pleasure to announce the release of Jark 0.3, today. Why Jark? Startup time of the Java Virtual Machine(JVM) is too slow and thereby command-line applications on the JVM are sluggish and very painful to use. Jark is an attempt to run a persistent JVM daemon and provide a set of utilit

Re: Eval destroys equality

2011-05-05 Thread Jonathan Fischer Friberg
It also seems that I have been linking to the wrong repo... :S https://github.com/clojure/clojure Should be the correct one. On Thu, May 5, 2011 at 6:09 PM, Jonathan Fischer Friberg < odysso...@gmail.com> wrote: > I'm also interested in that. > I think it has to do with how clojure.lang.Compiler

Re: Eval destroys equality

2011-05-05 Thread Jonathan Fischer Friberg
I'm also interested in that. I think it has to do with how clojure.lang.Compiler [1] works (since that is what eval uses), but since it is quite big, I don't know exactly what parts are important. Jonathan [1] https://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/Compiler.java O

Re: Eval destroys equality

2011-05-05 Thread Dominikus
Thanks for the pointers to the implementation, Jonathan! Unfortunately, I couldnt' find out yet, which part of the source code in Clojure 1.3 is responsible for fixing the misbehavior in 1.2. The parts you point to haven't changed in 1.3. Cheers, Dominikus On May 5, 4:27 pm, Jonathan Fischer Fr

Re: Eval destroys equality

2011-05-05 Thread Dominikus Herzberg
Thanks a lot, Armando. Looks like I should switch to Clojure 1.3 asap. Cheers, Dominikus 2011/5/5 Armando Blancas : > In 1.3 the function will (eval) to itself: > > Clojure 1.3.0-alpha6 > user=> (defn id [x] (list id x)) > #'user/id > user=> (id 7) > (# 7) > user=> (eval (id 7)) > (# 7) > user=>

Re: Recreate a hierarchy

2011-05-05 Thread Timo Mihaljov
On Thu, May 05, 2011 at 05:40:02AM -0700, Steffen wrote: > Hello, > > I'm trying to come up with a way to recreate a directory hierarchy. Entries > within zip archives are just flat strings like "top/level/file1", but I would > like to operate on them hierarchically. So my problem could be stated

Aw: Re: Recreate a hierarchy

2011-05-05 Thread Steffen
Am Donnerstag, 5. Mai 2011 16:06:52 UTC+2 schrieb odyssomay: > > This is my take on this: http://gist.github.com/957028 > The second file produces the correct result. The result isn't exactly like > you asked for. This is because it wouldn't support files that isn't in the > lowest level. Your

Re: Recreate a hierarchy

2011-05-05 Thread Ambrose Bonnaire-Sergeant
Beautiful solution, I got a lot out of it. Thanks Juha! -- Ambrose On Thu, May 5, 2011 at 10:08 PM, Juha Arpiainen wrote: > (defn add-path [h path] > (let [dir (butlast path) >entry (last path)] >(update-in h dir (fn [x] (if x (conj x entry) [entry]) > > (defn restore-hierarchy

Re: Eval destroys equality

2011-05-05 Thread Armando Blancas
In 1.3 the function will (eval) to itself: Clojure 1.3.0-alpha6 user=> (defn id [x] (list id x)) #'user/id user=> (id 7) (# 7) user=> (eval (id 7)) (# 7) user=> (= (id 7) (eval (id 7))) true On May 5, 6:04 am, Dominikus wrote: > My observation is best distilled with the following definition of a

Re: Eval destroys equality

2011-05-05 Thread Jonathan Fischer Friberg
= uses the clojure.lang.Util/equiv to compare two "things". The source of this function is: [1] static public boolean equiv(Object k1, Object k2){ if(k1 == k2) return true; if(k1 != null) { if(k1 instanceof Number && k2 instanceof Num

Re: Recreate a hierarchy

2011-05-05 Thread Juha Arpiainen
(defn add-path [h path] (let [dir (butlast path) entry (last path)] (update-in h dir (fn [x] (if x (conj x entry) [entry]) (defn restore-hierarchy [paths] (reduce add-path {} paths)) Then (restore-hierarchy [["top" "level" "file1"] ["top" "level" "file2"] ["top" "level2" "fil

Re: Recreate a hierarchy

2011-05-05 Thread Jonathan Fischer Friberg
This is my take on this: http://gist.github.com/957028 The second file produces the correct result. The result isn't exactly like you asked for. This is because it wouldn't support files that isn't in the lowest level. Ex: (restore-hierarchy [["top" "level" "file1"] ["top" "level" "file2"] ["top"

Re: resultset-seq

2011-05-05 Thread Allen Johnson
> I don't think it's flexible enough to attach this to the connection. I > work with databases where some groups of tables really need different > naming strategies than others so I would definitely want these > conversions available per operation - which is how c.j.j naming > strategies currently

Re: resultset-seq

2011-05-05 Thread Allen Johnson
> How about extending java.sql.ResultSet to implement > clojure.lang.Seqable instead?  Now that we have this capability > wouldn't it be ideal to not have any more foo*-seq functions? Since a ResultSet is also a resource that needs to be closed in a timely manner it might be clearer to follow the

Eval destroys equality

2011-05-05 Thread Dominikus
My observation is best distilled with the following definition of a function in Clojure 1.2: user=> (defn id [x] (list id x)) #'user/id Interstingly, (id 7) and (eval (id 7)) result in different instances of function id as the number after the '@' char unveils: user=> (id 7) (# 7) user=> (eval (

Recreate a hierarchy

2011-05-05 Thread Steffen
Hello, I'm trying to come up with a way to recreate a directory hierarchy. Entries within zip archives are just flat strings like "top/level/file1", but I would like to operate on them hierarchically. So my problem could be stated as: If (restore-hierarchy [["top" "level" "file1"] ["top" "l

Re: resultset-seq

2011-05-05 Thread Jeff Rose
How about extending java.sql.ResultSet to implement clojure.lang.Seqable instead? Now that we have this capability wouldn't it be ideal to not have any more foo*-seq functions? -Jeff On May 5, 6:04 am, Sean Corfield wrote: > I don't think it's flexible enough to attach this to the connection. I

Re: Search for a node querying on attrs

2011-05-05 Thread Alfredo
Ty very much :) Alfredo On May 5, 10:05 am, Thorsten Wilms wrote: > On 05/04/2011 06:23 PM, Alfredo wrote: > > > > > > I want to extract only the content part. > > I recently had related issues, so: > > (def metas >    (en/html-snippet >      "         charset=UTF-8\" /> >       ")) > > (en/sele

Re: [Enlive] Search for a node querying on attrs

2011-05-05 Thread Thorsten Wilms
On 05/04/2011 06:23 PM, Alfredo wrote: I want to extract only the content part. I recently had related issues, so: (def metas (en/html-snippet " ")) (en/select metas [[:meta (en/attr= :name "keywords")]]) (-> (en/select metas [[:meta (en/attr= :name "keywords")]]) first :at