Re: Trying to get a list of random numbers using repeat

2009-03-24 Thread Paul Drummond
2009/3/23 Krešimir Šojat kso...@gmail.com: (rand-int 49) will produce one integer, and repeat will repeat it 10 times, that is why you see same number repeated. How embarrassing! As soon as I switched my machine off last night I realised rand-int was only being called once - of course it

Re: Trying to get a list of random numbers using repeat

2009-03-24 Thread Joshua Fox
Why presumably with side effects?Otherwise you would use repeat. A pure function returns the same value every time, so there is no reason to call it repeatedly. Joshua On Tue, Mar 24, 2009 at 10:04 AM, Paul Drummond paul.drumm...@iode.co.ukwrote: 2009/3/23 Krešimir Šojat kso...@gmail.com:

Re: Trying to get a list of random numbers using repeat

2009-03-24 Thread Paul Drummond
2009/3/24 Joshua Fox joshuat...@gmail.com: Why presumably with side effects? Otherwise you would use repeat. A pure  function returns the same value every time, so there is no reason to call it repeatedly. Yup, that makes sense. Random numbers are side-effecting (is that the right term?) and

Re: Problem with CLASSPATH

2009-03-24 Thread Rich
Has anyone gotten 20090320 to work on a new MacBook Pro running Leopard? With further investigation, it looks like any call to (use...) either explicitly or as part of an (ns...) function call causes clojure to crash since the upgrade. I've fiddled around with the class path, and nothing seems

Re: Trying to get a list of random numbers using repeat

2009-03-24 Thread David Sletten
On Mar 23, 2009, at 10:36 PM, Paul Drummond wrote: 2009/3/24 Joshua Fox joshuat...@gmail.com: Why presumably with side effects? Otherwise you would use repeat. A pure function returns the same value every time, so there is no reason to call it repeatedly. Yup, that makes sense.

Re: PATCH: universal parent type for Clojure hierarchies

2009-03-24 Thread Konrad Hinsen
On Mar 23, 2009, at 23:11, Meikel Brandmeyer wrote: This is not correct. defmulti may take any of Clojure's reference types containing the hierarchy. So it doesn't need to be a Var. A Ref, an Atom or an Agent are also possible. Thanks for pointing this out. Here comes a corrected patch!

Generic functions again

2009-03-24 Thread mikel
News for the handful of people interested in gfs. Below is a sample trace of the gf implementation. Dispatch is wholly deterministic; you never need prefer-method. There is no need to specify a dispatch function, though dispatch customization is available if you want it. The default dispatch

Re: Generic functions again

2009-03-24 Thread Konrad Hinsen
On Mar 24, 2009, at 11:19, mikel wrote: Dispatch is wholly deterministic; you never need prefer-method. There Then what is the rule for choosing one method when there are several that match the arguments? In the scope in which a generic function is applied, next-method is always bound to

Re: parallel iteration

2009-03-24 Thread Phlex
On 24/03/2009 1:06, pmf wrote: On Mar 24, 12:01 am, Rowdy Rednoserowdy.redn...@gmx.net wrote: Hi group, say I have 2 sequences (def seq-a '(a1 a2 a3)) (def seq-b '(b1 b2 b3)) and want to iterate over them in parallel, like this (par-doseq [a seq-a b seq-b] (prn a b)) which

Re: STM and useful concurrency

2009-03-24 Thread Mark Volkmann
As was described in a Software Engineering Radio podcast on transactional memory, there are many parallels between garbage collection and transactional memory. Some parallels that aren't in place yet though include: 1) There are tools to measure the impact of GC on runs of an application, but we

Re: Suggestion for Java Clojure code, use of checkstyle or code formatter

2009-03-24 Thread Mark Volkmann
+1 for running all the code under src/jvm through some code formatter that uses something at least similar to the Sun Java conventions. On Mon, Mar 23, 2009 at 11:59 PM, BerlinBrown berlin.br...@gmail.com wrote: I was curious about how some of the clojure code worked and observed that the

Re: Problem with CLASSPATH

2009-03-24 Thread David Nolen
The latest version of Clojure incorporated lazy sequences which broke many libraries early on. Most of these problems have been worked out. In my experience you should use the cutting edge version of everything including SLIME. I clone everything from GitHub (clojure, clojure-contrib,

Re: Suggestion for Java Clojure code, use of checkstyle or code formatter

2009-03-24 Thread David Nolen
Javadoc would be nice, but I do note that Rich's Java code is pretty darn clear ;) I also note the indentation style is similar to Whitesmith's according to Wikipedia http://en.wikipedia.org/wiki/Indent_style. I've always preferred the BSD curly brace level matching convention over the KR

Re: STM and useful concurrency

2009-03-24 Thread cliffc
Some generic STM bits of wisdom: - STMs in standard languages (e.g. C, C++) suffer from having to track all memory references. THis overhead means the STM code typically starts 3x to 10x slower than non-STM code, which is a pretty stiff penalty to recover from. If you're only getting a 3x

Re: Generic functions again

2009-03-24 Thread Laurent PETIT
2009/3/24 Konrad Hinsen konrad.hin...@laposte.net On Mar 24, 2009, at 11:19, mikel wrote: Dispatch is wholly deterministic; you never need prefer-method. There Then what is the rule for choosing one method when there are several that match the arguments? In the scope in which a generic

Re: Suggestion for Java Clojure code, use of checkstyle or code formatter

2009-03-24 Thread Joshua
Even though I don't really care for the indentation style used, it is (unlike most projects) consistent and clear. Joshua On Mar 24, 8:40 am, David Nolen dnolen.li...@gmail.com wrote: Javadoc would be nice, but I do note that Rich's Java code is pretty darn clear ;) I also note the

Why not sorted-set-by?

2009-03-24 Thread hjlee
Hi, all. I'm experimenting clojure. Some code, I needed something like sorted-set-by, but no such thing. So i used sorted-map-by ignoring value part. Is it deliberate for some reason? Or just not there? --~--~-~--~~~---~--~~ You received this message because you

Re: Suggestion for Java Clojure code, use of checkstyle or code formatter

2009-03-24 Thread dysinger
You mean by Sun Norvig conventions right ? ;) http://code.google.com/p/clojure/issues/detail?id=16q=prettycolspec=ID%20Type%20Status%20Priority%20Reporter%20Owner%20Summary On Mar 24, 1:46 am, Mark Volkmann r.mark.volkm...@gmail.com wrote: +1 for running all the code under src/jvm through some

Why not sorted-set-by?

2009-03-24 Thread hjlee
Hi all. I'm experimenting cljoure. some code, i needed something like sorted-set-by. but, no such thing, so I emulated that using sorted-map-by. Is it deliberate for some reason? or just not there? --~--~-~--~~~---~--~~ You received this message because you are

Why not sorted-set-by?

2009-03-24 Thread hjlee
Hi, all. I'm experimenting clojure. Some code, I needed something like sorted-set-by, but no such thing. So i used sorted-map-by ignoring value part. Is it deliberate for some reason? Or just not there? --~--~-~--~~~---~--~~ You received this message because you

I'm experimenting clojure - sorted-set-by?

2009-03-24 Thread hjlee
Hi, all. I don't know why my previous posts ignored. spam filtering? so i changed title. I'm experimenting clojure. Some code, I needed something like sorted-set-by, but no such thing. So i used sorted-map-by ignoring value part. Is it deliberate for some reason? Or just not there?

Annotations and gen-class

2009-03-24 Thread Matt Revelle
Support for using JVM annotations with Clojure code has come up several times before, I'd like a feature request issue to be created and to start discussing the implementation. It seems that an annotations metadata tag could contain all annotations for an object, and any annotations that

Re: parallel iteration

2009-03-24 Thread Rowdy Rednose
Thanks guys, these solutions look much better already. But do I always have to have these 2 steps * merge collection * split collection It feels a bit inefficient, I don't know if it actually is, though. On Mar 24, 8:05 pm, Phlex ph...@telenet.be wrote: On 24/03/2009 1:06, pmf wrote: On

Re: Annotations and gen-class

2009-03-24 Thread Sean
Some working code would make it a lot easier to understand *exactly* what you're looking for. Do you think you could post a few quick methods on github? If memory serves, the reflections package should be a good place to start. However, you'd need to ask *why* you need this. If the answer is

Re: parallel iteration

2009-03-24 Thread Laurent PETIT
You could define a helper function, zip (as in Haskell) : (def zip (partial map list)) and then use as showed above: (doseq [[x y] (zip [:a :b] [1 2])] (println x: x , y: y)) 2009/3/24 Rowdy Rednose rowdy.redn...@gmx.net Thanks guys, these solutions look much better already. But do I

Re: parallel iteration

2009-03-24 Thread Sean
@Rowdy Take the time to do the interleave example by hand. You'll it does exactly what you want in one pass. On Mar 24, 10:10 am, Rowdy Rednose rowdy.redn...@gmx.net wrote: Thanks guys, these solutions look much better already. But do I always have to have these 2 steps * merge collection

simple debugging utility

2009-03-24 Thread Mark Volkmann
I want to write a function or macro that allows me to output the value of an expression without repeating it. For example, I want something like (dump (+ 1 2)) to output (+ 1 2) = 3. This works. (defn dump1 [string] (println string = (load-string string))) (dump1 (+ 1 2)) Note how I had to

simple debugging utility

2009-03-24 Thread Mark Volkmann
I want to write a function or macro that allows me to output the value of an expression without repeating it. For example, I want something like (dump (+ 1 2)) to output (+ 1 2) = 3. This works. (defn dump1 [string] (println string = (load-string string))) (dump1 (+ 1 2)) Note how I had to

Re: Problem with CLASSPATH

2009-03-24 Thread Stephen C. Gilardi
On Mar 24, 2009, at 5:03 AM, Rich wrote: Has anyone gotten 20090320 to work on a new MacBook Pro running Leopard? I tried it just now and it worked for me. Here's the test I did: - Download 20090320 zip file - Expand it into dir - create a file in dir called Structure.clj

Re: Problem with CLASSPATH

2009-03-24 Thread Mark Volkmann
On Tue, Mar 24, 2009 at 9:44 AM, Stephen C. Gilardi squee...@mac.com wrote: One thing to note is that namespace names should always have at least one period in them. I believe this is due to a rule regarding Java packages. At some point the clojure namespace became clojure.core for this

Re: Problem with CLASSPATH

2009-03-24 Thread Mark Volkmann
On Tue, Mar 24, 2009 at 9:44 AM, Stephen C. Gilardi squee...@mac.com wrote: One thing to note is that namespace names should always have at least one period in them. I believe this is due to a rule regarding Java packages. At some point the clojure namespace became clojure.core for this

Re: simple debugging utility

2009-03-24 Thread Konrad Hinsen
On Mar 24, 2009, at 15:44, Mark Volkmann wrote: I'm wondering if there is a way to avoid that using a macro. The hard part is printing the expression. The following doesn't work. It outputs 3 = 3. (defmacro dump2 [expr] `(let [value# ~expr] (pr ~expr) (println = value#)))

Re: simple debugging utility

2009-03-24 Thread Mark Volkmann
On Tue, Mar 24, 2009 at 9:55 AM, Konrad Hinsen konrad.hin...@laposte.net wrote: On Mar 24, 2009, at 15:44, Mark Volkmann wrote: I'm wondering if there is a way to avoid that using a macro. The hard part is printing the expression. The following doesn't work. It outputs 3 = 3. (defmacro

Re: simple debugging utility

2009-03-24 Thread Lauri Pesonen
2009/3/24 Mark Volkmann r.mark.volkm...@gmail.com: Thanks! It looks like I don't need the let now. Does a macro have to evaluate to one form? For example, this works, but it seems I can't drop the do. (defmacro dump [expr]  `(do     (print (quote ~expr))     (println = ~expr))) How

Re: simple debugging utility

2009-03-24 Thread Konrad Hinsen
On Mar 24, 2009, at 16:00, Mark Volkmann wrote: Thanks! It looks like I don't need the let now. Indeed. Does a macro have to evaluate to one form? For example, this works, but it seems I can't drop the do. Yes, a macro has to evaluate to one form. This is actually not so much a

Re: Problem with CLASSPATH

2009-03-24 Thread Stephen C. Gilardi
On Mar 24, 2009, at 10:49 AM, Mark Volkmann wrote: On Tue, Mar 24, 2009 at 9:44 AM, Stephen C. Gilardi squee...@mac.com wrote: One thing to note is that namespace names should always have at least one period in them. I believe this is due to a rule regarding Java packages. At some point

Re: simple debugging utility

2009-03-24 Thread Joshua Fox
Eric Rochester has a debug macro, together with a walkthrough of how he built it, here http://writingcoding.blogspot.com/2008/09/stemming-part-19-debugging.html Joshua On Tue, Mar 24, 2009 at 4:43 PM, Mark Volkmann r.mark.volkm...@gmail.comwrote: I want to write a function or macro that

Re: parallel iteration

2009-03-24 Thread Phlex
On 24/03/2009 15:10, Rowdy Rednose wrote: Thanks guys, these solutions look much better already. But do I always have to have these 2 steps * merge collection * split collection It feels a bit inefficient, I don't know if it actually is, though. Allright let's see what we can do : make a

Re: parallel iteration

2009-03-24 Thread Phlex
(defn par-doseq-fn [fn seqs] (loop [rests seqs] (when (every? identity (map seq rests)) (apply fn (map first rests)) (recur (map rest rests) It should of course be like this : (defn par-doseq-fn [fn seqs] (loop [rests seqs] (when (every? seq

Re: Annotations and gen-class

2009-03-24 Thread Matt Revelle
On Mar 24, 10:19 am, Sean francoisdev...@gmail.com wrote: Some working code would make it a lot easier to understand *exactly* what you're looking for. Do you think you could post a few quick methods on github? No need for gist, this will do as an example: (ns some.namespace (:gen-class

file io

2009-03-24 Thread e
is there something as simple as this in clojure? whole python program: of = open(filename,w) of.write(hello) of.close() I checked the api and looked around the wiki and google quickly and saw how to use java's stuff to do it ... but, welll... I noticed slurp in the api for reading

Re: parallel iteration

2009-03-24 Thread Phlex
(defn par-doseq-fn [fn seqs] (loop [rests seqs] (when (every? identity (map seq rests)) (apply fn (map first rests)) (recur (map rest rests) It should of course be like this : (defn par-doseq-fn [fn seqs] (loop [rests seqs] (when

Re: file io

2009-03-24 Thread Laurent PETIT
Hello, try (with-open [of (java.io.FileWriter. /path/to/your/file)] (.write of coucou)) As far as java libraries are concerned, and answer commonly seen in this ml is : use apache commons io. And indeed it does the job well, but, yes, it's then another dependency to your project, for what one

Re: file io

2009-03-24 Thread Parth Malwankar
e wrote: is there something as simple as this in clojure? whole python program: of = open(filename,w) of.write(hello) of.close() I checked the api and looked around the wiki and google quickly and saw how to use java's stuff to do it ... but, welll... There are possibly

Re: simple debugging utility

2009-03-24 Thread Tom Faulhaber
For reference, here's a version I wrote while I was working on cl- format and the pretty printer: (defn prerr [ args] Println to *err* (binding [*out* *err*] (apply println args))) (defmacro prlabel [prefix arg more-args] Print args to *err* in name = value format (cons 'prerr

Re: I'm experimenting clojure - sorted-set-by?

2009-03-24 Thread Frantisek Sodomka
Hello! Yes, you are right, sorted-set-by is missing. Good news is - it is on the way :-) See issue 76: http://code.google.com/p/clojure/issues/detail?id=76 Frantisek On Mar 24, 5:35 am, hjlee hj.d@gmail.com wrote: Hi, all. I don't know why my previous posts ignored. spam filtering? so

Namespace confusion using clojure.contrib.zip-filter

2009-03-24 Thread Tom Emerson
Hi all, I'm getting an error I don't quite understand. Starting Clojure (r1329) and entering user (ns foo (:use [clojure.contrib.zip-filter :as zf])) I get an exception, java.lang.IllegalStateException: descendants already refers to: #'clojure.core/descendants in namespace: foo

Re: Namespace confusion using clojure.contrib.zip-filter

2009-03-24 Thread Laurent PETIT
The doc doesn't claim that :as works with use. But it works well with require : user (ns foo (:require [clojure.contrib.zip-filter :as zf])) HTH, -- Laurent 2009/3/24 Tom Emerson tremer...@gmail.com Hi all, I'm getting an error I don't quite understand. Starting Clojure (r1329) and

Re: Namespace confusion using clojure.contrib.zip-filter

2009-03-24 Thread Stephen C. Gilardi
On Mar 24, 2009, at 1:01 PM, Tom Emerson wrote: Hi all, I'm getting an error I don't quite understand. Starting Clojure (r1329) and entering user (ns foo (:use [clojure.contrib.zip-filter :as zf])) Because you've used :use, you are referring all of clojure.contrib.zip-filter into foo.

Re: Generic functions again

2009-03-24 Thread mikel
On Mar 24, 7:59 am, Laurent PETIT laurent.pe...@gmail.com wrote: 2009/3/24 Konrad Hinsen konrad.hin...@laposte.net On Mar 24, 2009, at 11:19, mikel wrote: Dispatch is wholly deterministic; you never need prefer-method. There Then what is the rule for choosing one method when

re: oo

2009-03-24 Thread Raoul Duke
question: what do people think about the general topic of inheritance? my take on it so far is that inheritance apparently sounds like a good idea at first to some folks, but quickly turns into something of a nightmare if one is actually concerned with keeping a coherent semantics (so that (a)

Re: file io

2009-03-24 Thread Stuart Sierra
On Mar 24, 12:42 pm, Parth Malwankar parth.malwan...@gmail.com wrote: user= (with-open [f (writer (file test.txt))]          (binding [*out* f]            (println hello world !!!))) Or even more simply: (use 'clojure.contrib.duck-streams) (spit test.txt Hello, world!\n) -Stuart Sierra

Re: version of - short-circuiting on nil

2009-03-24 Thread Graham Fawcett
On Mon, Mar 23, 2009 at 6:49 PM, Laurent PETIT laurent.pe...@gmail.com wrote: Hello, there has been plenty of time to speak about that in the previous thread on the subject, and it's a shame these interesting proposals had to wait for the release of the functionality to pop up :-). But I

Re: Suggestion for Java Clojure code, use of checkstyle or code formatter

2009-03-24 Thread wlr
On Mar 24, 7:46 am, Mark Volkmann r.mark.volkm...@gmail.com wrote: +1 for running all the code under src/jvm through some code formatter that uses something at least similar to the Sun Java conventions. On Mon, Mar 23, 2009 at 11:59 PM, BerlinBrown berlin.br...@gmail.com wrote: I was

Re: STM and useful concurrency

2009-03-24 Thread Bradbev
On Mar 24, 5:56 am, cliffc cli...@acm.org wrote: Some generic STM bits of wisdom: - STMs in standard languages (e.g. C, C++) suffer from having to track all memory references.  THis overhead means the STM code typically starts 3x to 10x slower than non-STM code, which is a pretty stiff

Re: oo

2009-03-24 Thread mikel
On Mar 24, 12:58 pm, Raoul Duke rao...@gmail.com wrote: question: what do people think about the general topic of inheritance? my take on it so far is that inheritance apparently sounds like a good idea at first to some folks, but quickly turns into something of a nightmare if one is

Re: What's a convenient way of calling super.method()?

2009-03-24 Thread CuppoJava
*bump* Just letting people know that this is still an important and unresolved issue for me. Calling super multi-methods? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: file io

2009-03-24 Thread e
does anyone else think that should be more fundamental like the python example? imagine saying that out loud to your friend who asks . . . and the amount of noise, visually: use clojure dot contrib dot duck dash streams. perhaps it is already the hope that it will spit will eventually sit next

Re: Suggestion for Java Clojure code, use of checkstyle or code formatter

2009-03-24 Thread Howard Lewis Ship
+1 Using regular and proper formatting assists in submitting patches. A little Javadoc would be nice as well. On Tue, Mar 24, 2009 at 4:46 AM, Mark Volkmann r.mark.volkm...@gmail.com wrote: +1 for running all the code under src/jvm through some code formatter that uses something at least

Re: simple debugging utility

2009-03-24 Thread Meikel Brandmeyer
Hi, Am 24.03.2009 um 16:00 schrieb Mark Volkmann: Thanks! It looks like I don't need the let now. But there are reasons to keep it! Eg. returning the expression result! (defmacro dump [expr] `(let [value# ~expr] (println (pr-str (quote ~expr)) = (pr-str value#)) value#)) Then

Re: Generic functions again

2009-03-24 Thread Meikel Brandmeyer
Hi, Am 24.03.2009 um 18:51 schrieb mikel: (define-method add [x y] ...) (define-method add [[x java.lang.Integer] y] ...) (define-method add [x [y java.lang.Integer]] ...) and call (add 3 3). Which of the methods is chosen? Isn't it the second, which is the most

Re: Suggestion for Java Clojure code, use of checkstyle or code formatter

2009-03-24 Thread Meikel Brandmeyer
Hi, Am 24.03.2009 um 20:08 schrieb Howard Lewis Ship: Using regular and proper formatting assists in submitting patches. hahaha! If someone submitting a patch ever adhered to a coding convention of any sort. A little Javadoc would be nice as well. Yes. That would definitively be a good a

Re: Generic functions again

2009-03-24 Thread mikel
On Mar 24, 3:39 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 24.03.2009 um 18:51 schrieb mikel:        (define-method add [x y] ...)        (define-method add [[x java.lang.Integer] y] ...)        (define-method add [x [y java.lang.Integer]] ...) and call (add 3 3). Which of

Bit-syntax (Was: Re: I need help tracking down a performance problem.)

2009-03-24 Thread Kyle Schaffrick
On Mon, 23 Mar 2009 19:41:07 -0700 Mark Engelberg mark.engelb...@gmail.com wrote: On Mon, Mar 23, 2009 at 7:31 PM, Vincent Foley vfo...@gmail.com wrote: More generally, is it possible that I'm just doing this whole thing wrong?  That using vectors to represent binary fields and records

Re: file io

2009-03-24 Thread e
i guess another way to say this is that I can see both sides of the argument ... on one side, it shouldn't be a priority to resolve problems that java already provides when there are probably other more pressing issues. And it's part of the design decision to allow users to leverage java

Re: STM and useful concurrency

2009-03-24 Thread Tom Davies
I think Cliff may mean that each STM-participating memory access is 3x slower, but in Clojure, because of immutability, a very small proportion of accesses are Ref accesses, whereas in C/C++ *all* memory accesses would be. I agree that there's lots of room for adding instrumentation to Clojure's

Re: Problem with CLASSPATH

2009-03-24 Thread Rich
I think I figured it out. If I install clojure.jar into /Library/Java/Extensions/ (the ext directory on Macs) then it won't work. Even if I use java -cp ... to point to a different clojure.jar. Simply having the jar in that folder breaks things. Once I deleted it from /Library/Java/Extensions,

Re: Generic functions again

2009-03-24 Thread Meikel Brandmeyer
Hi, Am 24.03.2009 um 22:36 schrieb mikel: CLOS says that if two matches are otherwise equally specific, the one on the left wins. Similarly, it says that if two classes define slots with the same name, the one farthest from the root of the class heterarchy (as defined by a standard traversal

Re: STM and useful concurrency

2009-03-24 Thread Howard Lewis Ship
A relevant question is: what is the relative cost of locking and blocking (in the pure Java approach) vs. the cost of retrying (in the Clojure/STM approach). I don't want to go out on a limb, having not looked at the Clojure STM implementation. However, I would bet that the costs are roughly

Re: parallel iteration

2009-03-24 Thread Rowdy Rednose
Thanks all, microbenchmarking shows that a simple (time (doseq [[a b] (map vector list-a list-b)])) is ~50% faster on my system than (def par-doseq-fn (comp dorun map)) (defmacro par-doseq [bindings body] (let [bindings (partition 2 bindings)] `(par-doseq-fn (fn ~(vec (map first

Re: STM and useful concurrency

2009-03-24 Thread Dan
I don't want to go out on a limb, having not looked at the Clojure STM implementation. However, I would bet that the costs are roughly equal. Even if Clojure was 50% slower, or 100% slower, the knowlege that you can spin up a large number of threads and not worry about deadlocks is

Re: STM and useful concurrency

2009-03-24 Thread Christian Vest Hansen
On Tue, Mar 24, 2009 at 11:40 PM, Howard Lewis Ship hls...@gmail.com wrote: A relevant question is: what is the relative cost of locking and blocking (in the pure Java approach) vs. the cost of retrying (in the Clojure/STM approach). I can't think, off the top of my head, of a fair way to

dynamic member-symbol in (.) form

2009-03-24 Thread ninix
Hi, Is there any way to get a dynamic member-symbol for use in the (.) special form? For example, I get the following exception: user= (def obj (Object.)) #'user/obj user= (. obj (symbol f)) java.lang.IllegalArgumentException: No matching method found: symbol for class java.lang.Object I

Re: file io

2009-03-24 Thread Parth
On Mar 24, 11:53 pm, e evier...@gmail.com wrote: does anyone else think that should be more fundamental like the python example?  imagine saying that out loud to your friend who asks . . . and the amount of noise, visually: use clojure dot contrib dot duck dash streams. perhaps it is

Re: Proposed Change to str-utils

2009-03-24 Thread Sean
Okay, I've made some changes to my proposed str-utils. I've also got a few answers to some of the issues Stuart raised. New Changes 1. re-strip is now lazy I re-wrote this method to used the re-partition method in str-utils. This enables the laziness, and helped be consolidate my Java

Re: Proposed Change to str-utils

2009-03-24 Thread pc
Hi, I would generally agree with Stuart that wrapping Java functions is not a good idea. However, string functions come up so often that I think that this is one area where the rule should be broken, if only for readablility. Making str-utils kick-ass is a great idea. pc On Mar 24, 7:05 pm,

Re: Mapping a function over a map's values

2009-03-24 Thread Jon
Awesome. Thanks Konrad. On Mar 23, 4:11 am, Konrad Hinsen konrad.hin...@laposte.net wrote: On 22.03.2009, at 21:10, Jon Nadal wrote: I often need to map a function over the values of a map while preserving keys--something like: ... Is there a more concise way to do this in Clojure?  

Re: file io

2009-03-24 Thread Korny Sietsma
It'd be nice to have a macro that worked more like the first example - spit is great for one-liners, but the fact that it opens and closes the file each time you call it seems a bit painful for anything more complex. Something that ends up working like: (with-out-as test.txt (println hello)

Re: file io

2009-03-24 Thread e
I'm interested to know what the process/priority is on bubbling things up from contrib into the core. Is a discussion under way about going through it all? I also think it's good to have cross-language conventions sometimes unless there are compelling reasons. For example, slurp is, perhaps,

Re: Generic functions again

2009-03-24 Thread mikel
On Mar 24, 5:37 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 24.03.2009 um 22:36 schrieb mikel: CLOS says that if two matches are otherwise equally specific, the one on the left wins. Similarly, it says that if two classes define slots with the same name, the one farthest from

Re: file io

2009-03-24 Thread Cosmin Stejerean
On Tue, Mar 24, 2009 at 10:19 PM, e evier...@gmail.com wrote: I'm interested to know what the process/priority is on bubbling things up from contrib into the core. Is a discussion under way about going through it all? I also think it's good to have cross-language conventions sometimes