Re: how goes ClojureCheck?

2009-12-02 Thread Meikel Brandmeyer
Hi, On Dec 2, 2:48 am, Raoul Duke rao...@gmail.com wrote: ah. i guess i'm supposed to use clojure.test and clojure.test.tap, i see. This is probably the right thing to do. I plan to work on ClojureCheck again soon. But at the moment I don't have enough spare time. I hope to find some time over

Re: HOWTO: Compojure Development without Web Server Restarts using VimClojure

2009-12-02 Thread Meikel Brandmeyer
Hi, Cool. Thank you for your report! Just some notes. On Dec 2, 3:10 am, Gilbert gilbert.kf.le...@gmail.com wrote: - vimclojure offers a number of features, but the documentation is hidden in a text file inside ~/.vim/doc/clojure.txt (you can also read it here:  

Re: simple journal-based persistenсe for Clojure

2009-12-02 Thread Sergey Didenko
It creates journals in readable and executable form: 1.journal (tr-fn 1 2) ;1 (tr-fn 10 20) ;2 (tr-fn-swap) ;3 (tr-inc) ;4 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts

Handling XML

2009-12-02 Thread Dennis
Howdy, Being new to clojure, I am having a difficult time parsing XML in an elegant manner. I am pulling metric information from a ganglia server as XML and then parsing it. The below function works but it makes me feel icky. I was hoping for some tips. The dc variable contains a map with

Re: Datatypes and protocols - update

2009-12-02 Thread Rich Hickey
On Dec 2, 12:29 am, Krukow karl.kru...@gmail.com wrote: On Dec 1, 10:56 pm, Rich Hickey richhic...@gmail.com wrote: [snip] There are 2 ways to make a deftype reach a protocol. First, you can implement the protocol directly in the deftype/reify, supplying the protocol where you do

Re: What about contains? for lists

2009-12-02 Thread Erik Price
On Wed, Dec 2, 2009 at 10:10 AM, Stefan Kamphausen ska2...@googlemail.comwrote: OK, the doc of contains? told me that for indexed collection-types it will only check, whether the index is within the valid range. So maybe: user (contains? (list 1 2 3) 1) false At that point I dived into

Eleven Theses on Clojure

2009-12-02 Thread Martin Coxall
Tim Bray starts with the delightfull forthright Clojure is the best Lisp ever! and then goes on to explain why the JVM's current lack of hard tail calls don't matter. http://www.tbray.org/ongoing/When/200x/2009/12/01/Clojure-Theses Interesting, and certainly confirms my own prejudices about

inverse of interleave = unravel

2009-12-02 Thread kony
Recently I need something which works as inverse of interleave I did something like that: (defn unravel [expr-list] (loop [flist () slist () tic-tac 0 olist expr-list] (let [item (first olist)] (if (= item nil) (list

Re: Handling XML

2009-12-02 Thread Graham Fawcett
On Wed, Dec 2, 2009 at 11:29 AM, Dennis shr3ks...@gmail.com wrote: Sean, I probably did not make it clear, but I am using parse.  The second line of handle-xml function in my original E-Mail has the parse in it.  I then iterate over the xml-seq. Are you familiar with 'zippers'? There is a

Re: inverse of interleave = unravel

2009-12-02 Thread Wilson MacGyver
the only solution comes to mind is a two pass partition. ie (flatten (partition 1 2 dl)) for the first list and (flatten (partition 1 2 (rest dl))) for the 2nd list. 2009/12/2 Konrad Kułakowski (kony) kulakow...@gmail.com: Recently I need something which works as inverse of interleave I did

Re: Datatypes and protocols - update

2009-12-02 Thread Krukow
Thanks for sharing the insights. /Karl -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To

Re: Handling XML

2009-12-02 Thread pmf
On Dec 2, 4:51 pm, Dennis shr3ks...@gmail.com wrote: The XML is of the form: ganglia   multiple clusters     multiple hosts       multiple metrics Use XPath. Seriously, I hate XML and XSLT, but XPath is simply the most concise way to extract things from a nested structure. Most XPath-

Re: Handling XML

2009-12-02 Thread Tayssir John Gabbour
Hi! Taking minor liberties with your code (for clarity), the following gives pretty much the same result as your handle-xml function: (ns blah (:require [clojure.xml :as xml] [clojure.zip :as zip]) (:use clojure.contrib.zip-filter.xml)) (defn my-test [] (doseq [x (xml-

Re: Handling XML

2009-12-02 Thread Tayssir John Gabbour
BTW, I should point out that zip-filter.xml/xml- is surprisingly syntaxy. (xml- loc :CLUSTER :HOST :METRIC (fn [loc] [[(xml1- (zip/up loc) (attr :NAME)) (xml1- loc (attr :NAME)) (xml1- loc (attr :VAL)) (xml1- loc

Re: inverse of interleave = unravel

2009-12-02 Thread ataggart
On Dec 2, 9:10 am, Konrad Kułakowski (kony) kulakow...@gmail.com wrote: Recently I need something which works as inverse of interleave I did something like that: (defn unravel [expr-list]         (loop [flist () slist () tic-tac 0 olist expr-list]                 (let [item (first olist)]

Re: Handling XML

2009-12-02 Thread Dennis
Thanks, I think I have the idea. (ns ziptest (:require [clojure.zip :as zip] [clojure.xml :as xml] [clojure.contrib.zip-filter :as zf]) (:use clojure.contrib.zip-filter.xml) (:import (java.io ByteArrayInputStream))) (def *xml-string*

Space usage of lazy seqs

2009-12-02 Thread Johann Hibschman
I don't understand Clojure's space requirements when processing lazy sequences. Are there some rules-of-thumb that I could use to better predict what will use a lot of space? I have a 5.5 GB pipe-delimited data file, containing mostly floats (14 M rows of 40 cols). I'd like to stream over that

Re: Handling XML

2009-12-02 Thread Dennis
Thanks a bunch, this has been very helpful. -- Dennis On Wed, Dec 2, 2009 at 1:03 PM, Tayssir John Gabbour tayssir.j...@googlemail.com wrote: BTW, I should point out that zip-filter.xml/xml- is surprisingly syntaxy. (xml- loc :CLUSTER :HOST :METRIC (fn [loc]

Re: Space usage of lazy seqs

2009-12-02 Thread ataggart
On Dec 2, 10:50 am, Johann Hibschman joha...@gmail.com wrote: I don't understand Clojure's space requirements when processing lazy sequences. Are there some rules-of-thumb that I could use to better predict what will use a lot of space? I have a 5.5 GB pipe-delimited data file, containing

Re: Space usage of lazy seqs

2009-12-02 Thread ataggart
On Dec 2, 10:50 am, Johann Hibschman joha...@gmail.com wrote: I don't understand Clojure's space requirements when processing lazy sequences. Are there some rules-of-thumb that I could use to better predict what will use a lot of space? I have a 5.5 GB pipe-delimited data file, containing

Re: inverse of interleave = unravel

2009-12-02 Thread Christophe Grand
Hi, 2009/12/2 Konrad Kułakowski (kony) kulakow...@gmail.com Recently I need something which works as inverse of interleave I did something like that: (defn unravel [expr-list] (loop [flist () slist () tic-tac 0 olist expr-list] (let [item (first olist)]

Re: inverse of interleave = unravel

2009-12-02 Thread Chouser
On Wed, Dec 2, 2009 at 2:06 PM, ataggart alex.tagg...@gmail.com wrote: On Dec 2, 9:10 am, Konrad Kułakowski (kony) kulakow...@gmail.com wrote: Recently I need something which works as inverse of interleave How about this? (defn skip [coll n]  (lazy-seq    (when-let [s (seq coll)]      

Re: What about contains? for lists

2009-12-02 Thread ataggart
On Dec 2, 7:10 am, Stefan Kamphausen ska2...@googlemail.com wrote: Hi, while studying the collection types and trying to find out which functions work on all collection types (i.e. lists, vectors, maps, sets) I was flabbergasted by the following user (contains? (list 1 2 3) 3) false OK,

Re: What about contains? for lists

2009-12-02 Thread ataggart
On Dec 2, 12:06 pm, ataggart alex.tagg...@gmail.com wrote: On Dec 2, 7:10 am, Stefan Kamphausen ska2...@googlemail.com wrote: Hi, while studying the collection types and trying to find out which functions work on all collection types (i.e. lists, vectors, maps, sets) I was

Re: Leiningen Run ?

2009-12-02 Thread Zach Tellman
On Dec 2, 12:38 pm, David Nolen dnolen.li...@gmail.com wrote: Yeah it sounds like you'll need to package up JOGL 2 and push it to Clojars right? On Wed, Dec 2, 2009 at 3:20 PM, Zach Tellman ztell...@gmail.com wrote: On Dec 1, 3:31 pm, David Nolen dnolen.li...@gmail.com wrote: So just to

concurrent tests?

2009-12-02 Thread Raoul Duke
hi, i've seen some blog posts / code about using agents to use up cores/hyper-threading and speed up testing cycles. how might one do that with clojure.test{.tap}? like if somebody already has that in github somewhere i don't want to reinvent the wheel. thanks. -- You received this message

Hiring clojure devs again :)

2009-12-02 Thread dysinger
We need to hire another two full-time devs (!) to work on a clojure project (distributed backend on clojure). Don't be nervous about that old job - take a risk! Wake up and work in your PJs with interesting code and get paid to code in clojure! (I live on Kauai, HI) The team currently consists of

Re: What about contains? for lists

2009-12-02 Thread ataggart
On Dec 2, 1:32 pm, Stefan Kamphausen ska2...@googlemail.com wrote: Hi, On Dec 2, 10:24 pm, ataggart alex.tagg...@gmail.com wrote: My guess is that String and array, while not implementing the IAssociative interface, all have the O(1) lookup performance guarantees of associative data

Re: Clojure Koans?

2009-12-02 Thread Jim Weirich
On Dec 2, 2009, at 4:36 PM, ataggart wrote: If by koan you mean usage examples, then there are plenty of them within the clojure source itself, as well as clojure-contrib. The Koans are more than just examples. They are designed to demonstrate one concept at a time and are arranged so that

Minimum value in a vector

2009-12-02 Thread Don
I am having difficulty approaching this problem. I'm not sure if it can be done in one swoop, or requires a few steps. I have 5 vectors as such: a [2 4 6 7] b [1 3 9 2] c [2 4 5 6] d [6 1 3 8] e [4 8 2 1] And I want to take the minimum value at a given index between the vectors. Therefore,

Article in German Linux Magazin

2009-12-02 Thread Stefan Kamphausen
Hi, having received the blessings of #clojure (kind of) I'll be bold enough to post a link to an article on Clojure that was published today. http://www.linux-magazin.de/Heft-Abo/Ausgaben/2010/01/Nebenlaeufig Please note, that as of today you can also buy that fine magazine in print. ;-)

Re: Minimum value in a vector

2009-12-02 Thread Wilson MacGyver
assuming, vector a b c d e are already defined. I'd do user= (map vector a b c d e) ([2 1 2 6 4] [4 3 4 1 8] [6 9 5 3 2] [7 2 6 8 1]) you can then use the solutions provided from previous messages to find the min value of each vector. so you then end up with [0 1 0 0 0] [0 0 0 1 0] [0 0 0 0

Re: Minimum value in a vector

2009-12-02 Thread John Harrop
On Wed, Dec 2, 2009 at 5:43 PM, Don josereyno...@gmail.com wrote: I am having difficulty approaching this problem. I'm not sure if it can be done in one swoop, or requires a few steps. I have 5 vectors as such: a [2 4 6 7] b [1 3 9 2] c [2 4 5 6] d [6 1 3 8] e [4 8 2 1] And I want to

Re: Clojure Koans?

2009-12-02 Thread Matthew Williams
On Dec 2, 12:43 pm, Jim Weirich jim.weir...@gmail.com wrote: On Dec 2, 2009, at 4:36 PM, ataggart wrote: If by koan you mean usage examples, then there are plenty of them within the clojure source itself, as well as clojure-contrib. The Koans are more than just examples.  They are

Re: Article in German Linux Magazin

2009-12-02 Thread twitter.com/nfma
Is there a translation? Google translator is not so good and I only know basic German... 2009/12/2 Stefan Kamphausen ska2...@googlemail.com Hi, having received the blessings of #clojure (kind of) I'll be bold enough to post a link to an article on Clojure that was published today.

Re: Space usage of lazy seqs

2009-12-02 Thread David Brown
On Wed, Dec 02, 2009 at 02:01:36PM -0800, Johann Hibschman wrote: There is a qualitative difference between the runs, though. I can run test-split-3 five times in a row, all with similar times, without having the java process size get bigger than 0.6 GB. When I run any of the others, the size

Re: Minimum value in a vector

2009-12-02 Thread Wilson MacGyver
(defn min-dist [coll] (let [minval (reduce min coll)] (map #(if (= minval %) 1 0) coll))) this function, if you pass user= (min-dist [2 1 2 6 4]) (0 1 0 0 0) assume the 5 vectors are stored in a b c d e. user= (apply map vector (map min-dist (map vector a b c d e))) ([0 0 0 0] [1 0 0 0]

Re: Minimum value in a vector

2009-12-02 Thread Chouser
On Wed, Dec 2, 2009 at 6:22 PM, Don josereyno...@gmail.com wrote: Thank you Stefan and Kevin.  Awesome solutions that answer my question.  However I actually made a mistake in posing my question. Let me attempt to ask my question again.  I have 5 vectors as such:  a [2 4 6 7]  b [1 3

Java Class Factory

2009-12-02 Thread lazy1
Hello, I'm trying to create a factory method for Java classes, however I'm doing something wrong. (import '(java.util Dictionary HashMap)) (def *containers* { :dict Dictionary :hash HashMap}) (defn new-container [type] (new (*containers* type))) (def d (new-container :dict)) The above

Re: ClojureCLR questions

2009-12-02 Thread dmiller
1. CLR Interop: Interop is the focus of development at the moment. Work is progressing on those things that the JVM implementation doesn't worry about: ref/out params, assembly references, generics, etc.I haven't spent much think time on attributes yet. Do you have some specific use cases?

Re: Minimum value in a vector

2009-12-02 Thread Don
Thanks to everyone for the solutions. I actually wrote this terribly ugly function. Terrible. This should go in the don't write code like this section in clojure book. (defn md2 [d1 d2 d3 d4 d5] (let [cnt (count d1)] (loop [i 0 v []] (if (= i cnt) v (do (if (=

Re: Java Class Factory

2009-12-02 Thread Mike Hinchey
(new) tries to resolve the argument at compile-time, not runtime. You need to spell out each (new class) in a cond. You might write a macro to make it a little less verbose. -Mike -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Java Class Factory

2009-12-02 Thread ataggart
On Dec 2, 8:15 pm, lazy1 miki.teb...@gmail.com wrote: Hello, I'm trying to create a factory method for Java classes, however I'm doing something wrong. (import '(java.util Dictionary HashMap)) (def *containers* { :dict Dictionary :hash HashMap}) (defn new-container   [type]   (new

Re: Hiring clojure devs again :)

2009-12-02 Thread Dan Larkin
On Dec 2, 2009, at 5:04 PM, dysinger wrote: We need to hire another two full-time devs (!) to work on a clojure project (distributed backend on clojure). Don't be nervous about that old job - take a risk! Wake up and work in your PJs with interesting code and get paid to code in clojure!

API pages

2009-12-02 Thread Sean Devlin
Hey, the API page doesn't look right in Firefox 3.5 The cut off around halfway through the page. I think this also happens in Safari, but I'm not sure right now. Oh, and IE 6... YUCK! (But that's expected :)) Sean -- You received this message because you are subscribed to the Google Groups

Specified behavior of every?

2009-12-02 Thread Sean Devlin
The following return true: user=(every? even? nil) true user=(every? even? []) true Is this behavior the specified behavior? Can I ASSUME it is true in my code? Sean -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email

Re: Specified behavior of every?

2009-12-02 Thread Mark Triggs
I've always relied on this being true without losing sleep at night (or during the day), and it has a good grounding in predicate logic: http://en.wikipedia.org/wiki/Universal_quantification#The_empty_set Cheers, Mark Sean Devlin francoisdev...@gmail.com writes: The following return true:

Re: Specified behavior of every?

2009-12-02 Thread Richard Newman
Is this behavior the specified behavior? Can I ASSUME it is true in my code? I imagine that Clojure's some?/every? follow Common Lisp's every and some, defined as: every returns false as soon as any invocation of predicate returns false. If the end of a sequence is reached, every

Re: concurrent tests?

2009-12-02 Thread Brenton
Hello Raoul, I don't know if one of the blog posts that you are referring to was mine. I did blog yesterday about running tests concurrently. I have put the code that I use to run my tests on GitHib here: http://github.com/brentonashworth/fpl-clojure-util See the file test.clj I use this with

Re: Getting Started in Mac OS X Snow Leopard

2009-12-02 Thread Charras
Matthew; Thank you! Now I'm being able to program with Clojure. This was the route I should have use from the begging. Aquamacs is not very suitable for ELPA installations. Anyone who wants to use Clojure in Emacs, in a Mac OS X computer should follow this instructions. It's very easy. Guido On

Re: Space usage of lazy seqs

2009-12-02 Thread Dave M
On Dec 2, 9:09 pm, David Brown cloj...@davidb.org wrote: ... If you're running JDK 6, you can run the virtualvm, or jconsole to get a better handle on the memory usage, and even dig into what it might used for. Google does not return useful references to a tool called virtualvm; perhaps you

Re: Space usage of lazy seqs

2009-12-02 Thread Johann Hibschman
On Dec 2, 9:09 pm, David Brown cloj...@davidb.org wrote: How much memory do you have on your machine.  A recent Sun JVM on a machine with a bunch of memory will consider it to be a server machine.  It will set the heap max to 1/4 of total physical memory (which suggests you might have 16GB of

Re: Java Class Factory

2009-12-02 Thread Dave M
On Dec 2, 11:15 pm, lazy1 miki.teb...@gmail.com wrote: Hello, I'm trying to create a factory method for Java classes, however I'm doing something wrong. (import '(java.util Dictionary HashMap)) (def *containers* { :dict Dictionary :hash HashMap}) (defn new-container   [type]   (new