Re: Suggest fcase variant "pred-case"

2008-10-28 Thread Rich Hickey
On Oct 28, 4:13 pm, Martin DeMello <[EMAIL PROTECTED]> wrote: > On Oct 28, 6:35 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > > > My thoughts are that there should only be fcase > > PLT Scheme's pattern matching library might be a good source of > inspiration: > > http://download.plt-scheme.o

Re: string interpolation

2008-10-28 Thread Graham Fawcett
On Tue, Oct 28, 2008 at 7:27 PM, Graham Fawcett <[EMAIL PROTECTED]> wrote: > But for fun, here's an (i ...) macro, that will give you ${} > interpolation in strings (if it works at all, I test it very > thorougly!). Haha, nor did I spell- or grammar-check very thoroughly! I meant: I didn't test

Re: string interpolation

2008-10-28 Thread Graham Fawcett
On Mon, Oct 27, 2008 at 11:38 PM, Islon <[EMAIL PROTECTED]> wrote: > Is there any chance closure will get string interpolation? > > Do things like (prn "Hi ${someone}, my name is ${myname}") is nice, not > crucial of course, but nice. I'm personally not fond of string interpolation either. But f

Re: Suggest fcase variant "pred-case"

2008-10-28 Thread Mike Hinchey
On Tue, Oct 28, 2008 at 2:49 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 28, 10:29 am, Stuart Sierra <[EMAIL PROTECTED]> > wrote: >> I feel like "econdp" would be less clear, since you don't know what >> kind of exception should be thrown. Plain old Exception? Or >> RuntimeError? > > The

Re: commutes do not trigger validate-fn?

2008-10-28 Thread Rich Hickey
On Oct 28, 3:32 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Is this by design? It surprised me, as I expected all transactional > updates to be protected by validate-fn. > Fixed (svn 1085) - thanks for the report! Rich --~--~-~--~~~---~--~~ You received th

Re: Suggest fcase variant "pred-case"

2008-10-28 Thread Rich Hickey
On Oct 28, 10:29 am, Stuart Sierra <[EMAIL PROTECTED]> wrote: > On Oct 27, 10:45 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > > > I used Stuart Sierra's 'fcase' contrib today to good effect. Nice job, > > Stuart! > > Thanks! > > On Oct 28, 9:35 am, Rich Hickey <[EMAIL PROTECTED]> wrote:

Re: Chimp Patch - MacroExpand command

2008-10-28 Thread J. McConnell
On Tue, Oct 28, 2008 at 4:44 PM, mb <[EMAIL PROTECTED]> wrote: > > I added \me for macroexpand and \m1 for macroexpand-1. Great, thanks Meikel! - J. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: Newbie question: converting a sequence of map entries into a map

2008-10-28 Thread samppi
Excellent, that's exactly what I need. Thanks. On Oct 28, 12:09 pm, Matt Moriarity <[EMAIL PROTECTED]> wrote: > what you're looking for i believe is into > > > (into {} (list [:a 2] [:b 3])) > > {:b 3, :a 2} > > On Oct 28, 3:05 pm, samppi <[EMAIL PROTECTED]> wrote: > > > I'm new at Clojure, but I

Re: Chimp Patch - MacroExpand command

2008-10-28 Thread mb
Hi, On 28 Okt., 19:52, "J. McConnell" <[EMAIL PROTECTED]> wrote: > For anyone using Meikel Brandmeyer's Chimp plugin for Vim, below is a > patch that adds a MacroExpand command, which sends a (macroexpand-1 > ...) for the inner s-expr. Hope someone finds it useful. Thank you for the patch. I add

Re: Suggest fcase variant "pred-case"

2008-10-28 Thread Martin DeMello
On Oct 28, 6:35 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > > My thoughts are that there should only be fcase PLT Scheme's pattern matching library might be a good source of inspiration: http://download.plt-scheme.org/doc/352/html/mzlib/mzlib-Z-H-31.html#node_chap_31 martin --~--~-~--

commutes do not trigger validate-fn?

2008-10-28 Thread Stuart Halloway
Is this by design? It surprised me, as I expected all transactional updates to be protected by validate-fn. Stuart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: Newbie question: converting a sequence of map entries into a map

2008-10-28 Thread Matt Moriarity
what you're looking for i believe is into > (into {} (list [:a 2] [:b 3])) {:b 3, :a 2} On Oct 28, 3:05 pm, samppi <[EMAIL PROTECTED]> wrote: > I'm new at Clojure, but I'm really liking it, though. I'm having > trouble with using map on a map, and turning the resulting sequence of > map entries

Newbie question: converting a sequence of map entries into a map

2008-10-28 Thread samppi
I'm new at Clojure, but I'm really liking it, though. I'm having trouble with using map on a map, and turning the resulting sequence of map entries into a new map. In other words, how can you turn this: ([:a 2] [:b 3]) ...into... {:a 2, :b 3}? Thanks in advance. --~--~-~--~~

Re: Using a Java Debugger with Clojure

2008-10-28 Thread Scott Hickey
It should work. Before I had a debugging working in Eclipse with Groovy, I used JSwat, JEdit and Ant for project work with success. Scott Hickey Senior Consultant Object Partners, Inc. - Original Message From: Bill Clementson <[EMAIL PROTECTED]> To: clojure@googlegroups.com Sent: Tu

Re: Using a Java Debugger with Clojure

2008-10-28 Thread Bill Clementson
Hi Peter, On Tue, Oct 28, 2008 at 11:27 AM, Peter Wolf <[EMAIL PROTECTED]> wrote: > > Hello all, > > I am new to Clojure, but not Java or LISP (I used to work at LMI). > > I am considering a project written in a mixture of Clojure, Java and > Groovy. Clojure for the concurrent inner loop. Groov

Chimp Patch - MacroExpand command

2008-10-28 Thread J. McConnell
For anyone using Meikel Brandmeyer's Chimp plugin for Vim, below is a patch that adds a MacroExpand command, which sends a (macroexpand-1 ...) for the inner s-expr. Hope someone finds it useful. - J. Index: chimp.vim === --- chimp.v

Using a Java Debugger with Clojure

2008-10-28 Thread Peter Wolf
Hello all, I am new to Clojure, but not Java or LISP (I used to work at LMI). I am considering a project written in a mixture of Clojure, Java and Groovy. Clojure for the concurrent inner loop. Groovy/Grails for the Web UI. And lots of Java reused from other projects. How would I debug somet

Patch available: error message for bad prefix list in require/use

2008-10-28 Thread Stephen C. Gilardi
I intended to use a namespace declaration like this: user> (ns three-tier (:use clojure.contrib.sql)) nil but I mistakenly typed user> (ns three-tier (:use (clojure.contrib.sql))) nil The latter :use call accomplished nothing, but that bit of knowledge is hard

Re: idiomatic Clojure for agents?

2008-10-28 Thread Mark H.
On Oct 28, 8:48 am, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Java does thread protect, but it is synchronized. Also java.math and   > java.util's random number generator aren't pluggable with alternate   > implementations. For that I would need SecureRandom. > > For my simple example I think I

Re: idiomatic Clojure for agents?

2008-10-28 Thread Stuart Halloway
Java does thread protect, but it is synchronized. Also java.math and java.util's random number generator aren't pluggable with alternate implementations. For that I would need SecureRandom. For my simple example I think I will use a per-thread java.util.Random, note the issues, and point in

Re: idiomatic Clojure for agents?

2008-10-28 Thread Mark H.
On Oct 27, 7:06 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > ; take samples, tracking number that land > ; :in circle and :total number > (defn sample-for-pi [count] >    (reduce (fn [{in :in total :total} point] >             {:in (if (in-circle? point) (inc in) in) >              :total (inc

Re: idiomatic Clojure for agents?

2008-10-28 Thread Bill Clementson
Hi Stuart, A lot of parallel processing problems seem to lend themselves to a mapreduce approach. I've written a few blog entries on mapreduce in the past: http://bc.tech.coop/blog/060105.html http://bc.tech.coop/blog/070520.html http://bc.tech.coop/blog/070601.html Bill On Tue, Oct 28, 2008 a

Re: troubleshooting classloader problems

2008-10-28 Thread Allen Rohner
On Oct 28, 8:48 am, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Hi all, > > When I am troubleshooting classloader problems I find myself wanting   > to know the list of URLs currently on the classpath. I didn't find   > this exposed anywhere, so I wrote the functions below. > > Usage: > > (take 3

Re: idiomatic Clojure for agents?

2008-10-28 Thread Stuart Halloway
Hi Bill, Thanks, that's a good point re: await. It would also be interesting to have the agents run for a certain length of time, rather than a certain number of iterations. What do you think of using a map argument to a reduce fn? Idiomatic Clojure seems to prefer using a vector, but I am

Re: idiomatic Clojure for agents?

2008-10-28 Thread Bill Clementson
Hi Stuart, On Mon, Oct 27, 2008 at 7:06 PM, Stuart Halloway <[EMAIL PROTECTED]> wrote: > > Hi all, > > The code below implements a Monte Carlo simulation to estimate the > value of pi. It works, and it was easy to reuse the original single- > threaded approach across multiple agents. > > How idio

Re: idiomatic Clojure for agents?

2008-10-28 Thread Chouser
On Tue, Oct 28, 2008 at 9:51 AM, Stuart Halloway <[EMAIL PROTECTED]> wrote: > > P.S. I think that is the second time you have had to tell me to stop > using "count" as a local name. Bad habits die slowly... :-) Ah, don't worry about it. I'm still catching myself using "seq" as an argument name.

Re: Suggest fcase variant "pred-case"

2008-10-28 Thread Stuart Sierra
On Oct 27, 10:45 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > I used Stuart Sierra's 'fcase' contrib today to good effect. Nice job, > Stuart! Thanks! On Oct 28, 9:35 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > If you'd like, I think the effort would be better spent on making a > versi

Re: genclass error message

2008-10-28 Thread mb
Hi, On 7 Okt., 01:57, Chouser <[EMAIL PROTECTED]> wrote: > Currently if you fail to provide or mis-name the main fn in a > gen-class implementation, you get an error like: > > Exception in thread "main" java.lang.UnsupportedOperationException: > net.n01se/main not defined > > This is wrong, since

Re: genclass error message

2008-10-28 Thread Rich Hickey
On Oct 28, 9:51 am, mb <[EMAIL PROTECTED]> wrote: > Hi, > > On 7 Okt., 01:57, Chouser <[EMAIL PROTECTED]> wrote: > > > > > Currently if you fail to provide or mis-name the main fn in a > > gen-class implementation, you get an error like: > > > Exception in thread "main" java.lang.UnsupportedOper

Re: Suggest fcase variant "pred-case"

2008-10-28 Thread Stuart Sierra
Hi Stephen, Rich, I haven't had my tea yet either, so I'll look at this some more later. -S On Oct 28, 9:35 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 27, 10:45 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > > > I used Stuart Sierra's 'fcase' contrib today to good effect. Nice jo

Re: idiomatic Clojure for agents?

2008-10-28 Thread Stuart Halloway
I have not looked at pmap yet, but I expect it will be a better fit, since Monte Carlo is a good fit for Fork/Join. I am considering using this example across a variety of implementation strategies for the concurrency chapter in the book. Aside from agents and pmap, any other approaches spr

troubleshooting classloader problems

2008-10-28 Thread Stuart Halloway
Hi all, When I am troubleshooting classloader problems I find myself wanting to know the list of URLs currently on the classpath. I didn't find this exposed anywhere, so I wrote the functions below. Usage: (take 3 (classpath-url-seq)) -> ("file:/Users/stuart/relevance/personal/SHCLOJ_svn/Bo

Re: Suggest fcase variant "pred-case"

2008-10-28 Thread Rich Hickey
On Oct 27, 10:45 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > I used Stuart Sierra's 'fcase' contrib today to good effect. Nice job, > Stuart! > Yes, I haven't done enough poking around in contrib - fcase looks like a promising candidate for boot.clj. > I have an idea for another fcas

Re: classpath problem on MacOSX

2008-10-28 Thread Chanwoo Yoo
Thanks! It works! For someone like me, here is an example code. Case 1: clj file /Users/chanwoo/Documents/lisp/clojure/code/clojure/contrib/duck- streams/duck-stream.clj (add-classpath "file:///Users/chanwoo/Documents/lisp/clojure/code/") (use 'clojure.contrib.duck-streams) Case 2: Test class i

Re: classpath problem on MacOSX

2008-10-28 Thread mb
Hi, On 28 Okt., 12:42, Chanwoo Yoo <[EMAIL PROTECTED]> wrote: > Thanks! mb. I did a stupid mistake. There no stupid mistakes. Unless you do them twice... ;) > "export CLASSPATH=.:/Users/chanwoo/Documents/lisp/clojure/code: > $CLASSPATH" Is this verbatim? The first " should be after the =. ech

Re: classpath problem on MacOSX

2008-10-28 Thread Achim Passen
Ah, Java's classpath handling - a constant source of delight. Using $CLASSPATH is not a reliable way of adjusting your classpath, because its contents will only be considered if you don't specifiy anything else on the java command line, i.e. if you start clojure like this $ java -cp

Re: CLASSPATH problem on MacOSX

2008-10-28 Thread Giancarlo Angulo
not sure but try renaming = ANGOL = -|[EMAIL PROTECTED], =|+^_^X++~_~,@- "The only thing worse than a hopeless romantic is a hopeful one" Magbasa bago Mamuna. Mag-isip bago mambatikos Without Truth there is no Justice, Without Justice, there is Tyranny Semper fi Proof of De

Re: classpath problem on MacOSX

2008-10-28 Thread Chanwoo Yoo
Thanks! mb. I did a stupid mistake. But It still doesn't work after correcting typing. canu-yuyi-macbook-air:duck_streams chanwoo$ pwd /Users/chanwoo/Documents/lisp/clojure/code/clojure/contrib/ duck_streams canu-yuyi-macbook-air:duck_streams chanwoo$ ls duck_streams.clj ~/.profile "export CLAS

Re: string interpolation

2008-10-28 Thread Mike Benfield
I've always preferred a function like str to either of these options anyway. (str "Hi " someone ", my name is " myname) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send ema

Re: classpath problem on MacOSX

2008-10-28 Thread mb
Hi, On 28 Okt., 08:42, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi. > > When I try to use 'contrib' library, next error message occurs. > > user=> (use 'clozure.contrib.duck-streams) > java.io.FileNotFoundException: Could not locate Clojure resource on > classpath: clozure/contrib/duck_st

Re: string interpolation

2008-10-28 Thread mb
Hi Islon, On 28 Okt., 04:38, Islon <[EMAIL PROTECTED]> wrote: > Is there any chance closure will get string interpolation? > > Do things like (prn "Hi ${someone}, my name is ${myname}") is nice, not > crucial of course, but nice. There is format. user=> (def someone "World") #=(var user/someone)

classpath problem on MacOSX

2008-10-28 Thread [EMAIL PROTECTED]
Hi. When I try to use 'contrib' library, next error message occurs. user=> (use 'clozure.contrib.duck-streams) java.io.FileNotFoundException: Could not locate Clojure resource on classpath: clozure/contrib/duck_streams/duck_streams.clj My '.profile' file in home directory is as following: "expo

string interpolation

2008-10-28 Thread Islon
Is there any chance closure will get string interpolation? Do things like (prn "Hi ${someone}, my name is ${myname}") is nice, not crucial of course, but nice. Islon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "

CLASSPATH problem on MacOSX

2008-10-28 Thread Chanwoo Yoo
Hi. When I try to use 'contrib' library, next error message occurs. user=> (use 'clozure.contrib.duck-streams) java.io.FileNotFoundException: Could not locate Clojure resource on classpath: clozure/contrib/duck_streams/duck_streams.clj My '.profile' file in home directory are as following: "exp

classpath problem on MacOSX

2008-10-28 Thread [EMAIL PROTECTED]
Hi. When I try to use 'contrib' library, next error message occurs. user=> (use 'clozure.contrib.duck-streams) java.io.FileNotFoundException: Could not locate Clojure resource on classpath: clozure/contrib/duck_streams/duck_streams.clj My '.profile' file in home directory are as following: "exp