Re: Generic functions again

2009-03-24 Thread Cosmin Stejerean
On Tue, Mar 24, 2009 at 5:37 PM, Meikel Brandmeyer 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 fro

Re: file io

2009-03-24 Thread Cosmin Stejerean
On Tue, Mar 24, 2009 at 10:19 PM, e 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 unless > there are

Re: Generic functions again

2009-03-24 Thread mikel
On Mar 24, 5:37 pm, Meikel Brandmeyer 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 the ro

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, m

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: Mapping a function over a map's values

2009-03-24 Thread Jon
Awesome. Thanks Konrad. On Mar 23, 4:11 am, Konrad Hinsen 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?  If not, is this

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: 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 interacti

Re: file io

2009-03-24 Thread Parth
On Mar 24, 11:53 pm, e 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 already the h

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: STM and useful concurrency

2009-03-24 Thread Christian Vest Hansen
On Tue, Mar 24, 2009 at 11:40 PM, Howard Lewis Ship 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 compare the two

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 > ulti

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 b

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 equa

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 al

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, I

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: 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 libraries

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 wrote: > > On Mon, Mar 23, 2009 at 7:31 PM, Vincent Foley > wrote: > > More generally, is it possible that I'm just doing this whole thing > > wrong?  That using vectors to represent binary fields and records > > in a declarative is just a bad i

Re: Generic functions again

2009-03-24 Thread mikel
On Mar 24, 3:39 pm, Meikel Brandmeyer 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). Whi

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 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 specific

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#)) The

Re: Promise for absense of side effects

2009-03-24 Thread André Thieme
Another link that gives an easy understandable intro into gradual typing: http://ece-www.colorado.edu/~siek/gradualtyping.html By adding local and global switches this behaviour could be made completely optional, allowing everyone to have as much typing as one wants to have in the code. Btw, is

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 wrote: > > +1 for running all the code under src/jvm through some code formatter > that uses something at least similar to the Sun Java c

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 ne

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: oo

2009-03-24 Thread mikel
On Mar 24, 12:58 pm, Raoul Duke 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 actually concerned

Re: STM and useful concurrency

2009-03-24 Thread Bradbev
On Mar 24, 5:56 am, cliffc 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 penalty t

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 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 wrote: > > > I was curious about how some of the clojure code wor

Re: Proposed Change to str-utils

2009-03-24 Thread Stuart Sierra
On Mar 23, 9:46 pm, Sean wrote: > http://github.com/francoisdevlin/clojure-str-utils-proposal/tree/master > > I'm not sure what the directory structure should be for everything > still.  Perhaps somebody can point out how it should be done. > > I'll put the original post in the README > > Long st

Re: version of -> short-circuiting on nil

2009-03-24 Thread Graham Fawcett
On Mon, Mar 23, 2009 at 6:49 PM, Laurent PETIT 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 think it's my faul

Re: file io

2009-03-24 Thread Stuart Sierra
On Mar 24, 12:42 pm, Parth Malwankar 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: 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) peo

Re: Generic functions again

2009-03-24 Thread mikel
On Mar 24, 7:59 am, Laurent PETIT wrote: > 2009/3/24 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 t

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: 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 > > Hi all, > > I'm getting an error I don't quite understand. Starting Clojure > (r1329) and entering > > user>

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 (NO_SOURCE_FIL

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 wrote: > Hi, all. > I don't know why my previous posts ignored. > spam filtering? so i changed titl

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: 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

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 wha

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 se

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 rea

Re: Annotations and gen-class

2009-03-24 Thread Matt Revelle
On Mar 24, 10:19 am, Sean 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 :methods [^#{:annota

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?

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 : m

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 wrote: > > I want to write a function or macro that allows me to output the value

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 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" name

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 con

Re: simple debugging utility

2009-03-24 Thread Lauri Pesonen
2009/3/24 Mark Volkmann : > > 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 about: (defmacro

Re: simple debugging utility

2009-03-24 Thread Mark Volkmann
On Tue, Mar 24, 2009 at 9:55 AM, Konrad Hinsen 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 dump2 [expr]

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 " =" v

Re: Problem with CLASSPATH

2009-03-24 Thread Mark Volkmann
On Tue, Mar 24, 2009 at 9:44 AM, Stephen C. Gilardi 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 reason. I > ha

Re: Problem with CLASSPATH

2009-03-24 Thread Mark Volkmann
On Tue, Mar 24, 2009 at 9:44 AM, Stephen C. Gilardi 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 reason. I > ha

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 wi

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

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

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 wrote: > Thanks guys, these solutions look much better already. > > But do I always have to have these 2 steps > * merge collection > * split collecti

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 > > Thanks guys, these solutions look much better already. > > But do I always have to

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 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 wrote: > On 24/03/2009 1:06, pmf wrote: > > > On Mar 24, 12:01 a

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

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? --~--~--

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 ar

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

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=16&q=pretty&colspec=ID%20Type%20Status%20Priority%20Reporter%20Owner%20Summary On Mar 24, 1:46 am, Mark Volkmann wrote: > +1 for running all the code under src/jvm through some code formatter > that

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

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 wrote: > 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

Re: Generic functions again

2009-03-24 Thread Laurent PETIT
2009/3/24 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 ap

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 spe

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 K&R derivat

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, swank-cloju

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

2009-03-24 Thread Laurent PETIT
Why you guys want to suppress all the fun from clojure ? ;-) :-p 2009/3/24 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 > wrote: > >

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 wrote: > > I was curious about how some of the clojure code worked and observed > that the coding style is a littl

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 w

Re: parallel iteration

2009-03-24 Thread Phlex
On 24/03/2009 1:06, pmf wrote: > On Mar 24, 12:01 am, Rowdy Rednose 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))

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 t

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 fun

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!

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 : >>> 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

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 to

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

2009-03-24 Thread Paul Drummond
2009/3/24 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. Yup, that makes sense. Random numbers are side-effecting (is that the right term?) and I was trying t

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 wrote: > > 2009/3/23 Krešimir Šojat : > > (rand-int 49) will produce one in

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

2009-03-24 Thread Paul Drummond
2009/3/23 Krešimir Šojat : > (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 was! I did consid