Re: java/scala oneliner

2009-09-17 Thread Adrian Cuthbertson
If y're Sco'ish... -> 59 (dotimes[i 4](println"Appy Birthdy"({2"D'r XXX"}i"To Ye"))) Appy Birthdy To Ye Appy Birthdy To Ye Appy Birthdy D'r XXX Appy Birthdy To Ye On Fri, Sep 18, 2009 at 6:35 AM, David Nolen wrote: > hiredman in the lead! > (dotimes[i 4](println"Happy Birthday"({2"Dear XXX"}i

Re: java/scala oneliner

2009-09-17 Thread Richard Newman
> Clojure REPL will display nil for anything that causes side-effect? > I had no idea! More accurately, any side effects that print will be printed, then the return value of the function will be printed by the REPL (the "P" part). If the function returns nil, you'll see a final nil appear. ma

Re: java/scala oneliner

2009-09-17 Thread David Nolen
On Fri, Sep 18, 2009 at 2:41 AM, Wilson MacGyver wrote: > > Clojure REPL will display nil for anything that causes side-effect? > I had no idea! > No. The return value of println _is_ nil. map takes a collection of values and returns a new collection of values by applying the supplied fn on each

Re: java/scala oneliner

2009-09-17 Thread Wilson MacGyver
Clojure REPL will display nil for anything that causes side-effect? I had no idea! On Fri, Sep 18, 2009 at 2:24 AM, Krukow wrote: > Yes, the result of the computation is (nil nil nil nil), a side-effect > is printing: > Happy Birthday To You > Happy Birthday To You > Happy Birthday Dear XXX > Ha

Re: java/scala oneliner

2009-09-17 Thread Krukow
On Sep 18, 6:24 am, Wilson MacGyver wrote: > Hmmm, your solution produces nils in REPL. > > user=> (map #(printf "Happy Birthday %s\n" (if (= 2 %) "Dear XXX" "To > You")) (range 4)) > (Happy Birthday To You > Happy Birthday To You > nil Happy Birthday Dear XXX > nil Happy Birthday To You > nil

Re: loop-recur for string handling

2009-09-17 Thread Adrian Cuthbertson
There's also re-split in str-utils in clojure.contrib; (use 'clojure.contrib.str-utils) (re-split #"\s" "The quick brown fox") => ("The" "quick" "brown" "fox") You can then use all the good clojure collection functions; (def words (re-split #"\s" "The quick brown fox")) (some #{"brown"} words)

Re: Can anyone here give a comparison between Clojure and Erlang on concurrent programming?

2009-09-17 Thread Timothy Pratley
http://www.pragprog.com/magazines/download/1.pdf Page 16 RH talks about Erlang and Scala vs Clojure in an interview I found it to be a very useful comparison. On Sep 18, 8:54 am, dongbo wrote: > Hi everyone, > > Can any one give a comparison between Clojure and Erlang on concurrent > programmi

Re: Redefining Special Forms

2009-09-17 Thread Gorsal
Yes, that would work. I keep forgetting the try finally acts like unwind-protect. Even if the thread is killed the finally process will execute. Ehh... On Sep 17, 5:50 pm, John Harrop wrote: > On Thu, Sep 17, 2009 at 6:15 PM, Gorsal wrote: > > Or maybe i could simply push to the global var and

Re: java/scala oneliner

2009-09-17 Thread David Nolen
hiredman in the lead! (dotimes[i 4](println"Happy Birthday"({2"Dear XXX"}i"To You"))) -> 63 On Fri, Sep 18, 2009 at 12:32 AM, Kevin Downey wrote: > > :( > > map is lazy, so you'll need to wrap it in doall > > (dotimes [i 4] (println "Happy Birthday" ({2 "Dear XXX"} i "To You"))) > > On Thu, Sep

Re: java/scala oneliner

2009-09-17 Thread Kevin Downey
:( map is lazy, so you'll need to wrap it in doall (dotimes [i 4] (println "Happy Birthday" ({2 "Dear XXX"} i "To You"))) On Thu, Sep 17, 2009 at 9:17 PM, David Nolen wrote: > Actually to be fair, here's a Clojure version that uses as little whitespace > as the Scala and Java ones do. > (map #

Re: java/scala oneliner

2009-09-17 Thread David Nolen
(dotimes[x 4](println"Happy Birthday"(if(= x 2)"Dear XXX""To You"))) -> 68 chars! Sorry I'm getting carried away now :) On Fri, Sep 18, 2009 at 12:26 AM, David Nolen wrote: > (dorun(map #(println"Happy Birthday %s"(if(= 2 %)"Dear XXX""To You"))(range > 4))) ; -> 80 chars > should produce the corr

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Russell Christopher
In general I think the STM solution to most concurrency issues looks promising, however in the case of dining philosophers I found that Java locking was easier than a ref, atom or agent solution. ;; (import java.util.concurrent.locks.ReentrantReadWriteLock) (defn nth-chopstick [chopsticks i side]

Can anyone here give a comparison between Clojure and Erlang on concurrent programming?

2009-09-17 Thread dongbo
Hi everyone, Can any one give a comparison between Clojure and Erlang on concurrent programming? Both of them are kinda pure functional programming language, which avoiding the state changes in general. Erlang provides message passing mechanism to handle the inter-thread communication, while Clo

Re: java/scala oneliner

2009-09-17 Thread David Nolen
(dorun(map #(println"Happy Birthday %s"(if(= 2 %)"Dear XXX""To You"))(range 4))) ; -> 80 chars should produce the correct output at the repl. This is probably the most correct one. can we get shorter? :) On Fri, Sep 18, 2009 at 12:24 AM, Wilson MacGyver wrote: > > Hmmm, your solution produces ni

Re: Redefining Special Forms

2009-09-17 Thread John Harrop
On Thu, Sep 17, 2009 at 6:15 PM, Gorsal wrote: > Or maybe i could simply push to the global var and in addition to the > value use a unique gensymed id. Then once the local binding was done > it would pop until it sees its gensymed id. That would work in the > situation that a local binding faile

Re: java/scala oneliner

2009-09-17 Thread Wilson MacGyver
Hmmm, your solution produces nils in REPL. user=> (map #(printf "Happy Birthday %s\n" (if (= 2 %) "Dear XXX" "To You")) (range 4)) (Happy Birthday To You Happy Birthday To You nil Happy Birthday Dear XXX nil Happy Birthday To You nil nil) On Fri, Sep 18, 2009 at 12:19 AM, Krukow wrote: > > > >

Re: Anyone care to defend/comment some points in this presentation

2009-09-17 Thread John Harrop
On Thu, Sep 17, 2009 at 3:06 PM, Mark Volkmann wrote: > > On Thu, Sep 17, 2009 at 1:43 PM, z5h wrote: > > > > Specifically some problems encountered in Clojure's STM and bytecode > > generation. > > > > > http://www.azulsystems.com/events/javaone_2009/session/2009_J1_JVMLang.pdf > > (Slide's 8 an

Re: java/scala oneliner

2009-09-17 Thread Krukow
On Sep 18, 5:53 am, Wilson MacGyver wrote: > This blog post got me > thinking.http://www.artima.com/weblogs/viewpost.jsp?thread=268561 > > Basically it contains both a Java one liner and Scala one liner. > > Java: > for(int i=0; i<4; i++) { System.out.println("Happy Birthday " + (i==2 > ? "Dea

Re: java/scala oneliner

2009-09-17 Thread Wilson MacGyver
actually 82, you missed a ) at the end. should be (map #(str "Happy Birthday " %) (assoc (vec (replicate 4 "To You")) 2 "Dear XXX")) my other concern is what the article is discussing, namely making this readable to other people who don't know clojure. I don't know how readable it is to java p

Re: java/scala oneliner

2009-09-17 Thread David Nolen
Spoke too soon: (map #(str"Happy Birthday "%)(assoc(vec(replicate 4"To You"))2"Dear XXX")) -> 74 On Fri, Sep 18, 2009 at 12:17 AM, David Nolen wrote: > Actually to be fair, here's a Clojure version that uses as little > whitespace as the Scala and Java ones do. > > (map #(str"Happy Birthday "%)(

Re: java/scala oneliner

2009-09-17 Thread David Nolen
Actually to be fair, here's a Clojure version that uses as little whitespace as the Scala and Java ones do. (map #(str"Happy Birthday "%)(assoc (vec (replicate 4"To You"))2"Dear XXX")) ; -> 76 chars On Fri, Sep 18, 2009 at 12:14 AM, David Nolen wrote: > Your basic approach seems sound: > (map #(

Re: java/scala oneliner

2009-09-17 Thread David Nolen
Your basic approach seems sound: (map #(str "Happy Birthday " %) (assoc (vec (replicate 4 "To You")) 2 "Dear XXX") -> 81 chars including white space for(int i=0;i<4;i++){System.out.println("Happy Birthday "+(i==2?"Dear XXX":"To You"));}) -> 88 chars (1 to 4).map{i=>"Happy Birthday %s".format(if(i

(+ clojure cascading)

2009-09-17 Thread bradford cross
We're going to have a meetup on clojure and cascading and Rapleaf Sept 24th: http://blog.rapleaf.com/dev/?p=196 Come on by. Debate about function composition as a programming model for distributed computation. Impress your friends. -b --~--~-~--~~~---~--~~ You

java/scala oneliner

2009-09-17 Thread Wilson MacGyver
This blog post got me thinking. http://www.artima.com/weblogs/viewpost.jsp?thread=268561 Basically it contains both a Java one liner and Scala one liner. Java: for(int i=0; i<4; i++) { System.out.println("Happy Birthday " + (i==2 ? "Dear XXX" : "To You")); } Scala: (1 to 4).map { i => "Happy Bi

Re: I just posted a discussion of building webhooks in Clojure with Ring

2009-09-17 Thread Timothy Pratley
O_o mind bendingly awesome. Really great article! I found it very helpful thanks. On Sep 18, 8:35 am, Tom Faulhaber wrote: > In case this is interesting to anyone: > > I just posted a description of how I created the webhook system for > the contrib autodoc robot using Ring. Nothing too profou

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Hugh Aguilar
On Sep 17, 9:33 am, Brian wrote: > As a Java programmer coming to Clojure I would be very interested in the > intended application.  How you approach that from a Clojure perspective is > what I'm interested in.  I've programmed in Lisp in the distant past > (Symbolics Lisp machines) and still ha

Re: how to invoke a function using the function name string?

2009-09-17 Thread wireless
Thanks, that worked great! Since my func came from a different namespace, the following seems to work ok. (defn dispatcher [name-space func-name alist] (apply (ns-resolve *ns* (symbol func-name)) alist)) I am able to invoke this from my java code: RT.loadResourceScript(pathScript);

Re: loop-recur for string handling

2009-09-17 Thread Timothy Pratley
Also keep in mind that for string operations the Java String provides a lot of built in functionality: (let [s "the quick brown fox"] (.substring s (.indexOf s "brown"))) "brown fox" And you could simply ask the regular expression to find what you want: (re-find #"brown.*" "the quick brown fox")

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Rick Moynihan
2009/9/17 Hugh Aguilar : > > Thanks for the encouragement. I've already got the book. > > I suppose eventually I will have to learn Java. I have been putting it > off because I hear a lot of Java-bashing from programmers, and have > also noted that this is generally the impetus for the development

I just posted a discussion of building webhooks in Clojure with Ring

2009-09-17 Thread Tom Faulhaber
In case this is interesting to anyone: I just posted a description of how I created the webhook system for the contrib autodoc robot using Ring. Nothing too profound, but probably useful to others. You can find it here: http://infolace.blogspot.com/2009/08/simple-webhooks-with-clojure-and-ring.

Re: Modeling question multimethods or methodmaps?

2009-09-17 Thread atucker
Yes Rich Hickey advises against it here... http://groups.google.com/group/clojure/browse_frm/thread/9eaf7be6a65e70df# On Sep 17, 9:26 pm, David Nolen wrote: > I believe maps containing functions are generally looked down upon. > Multimethods are probably the way to go. Can't you tag your request

Re: Redefining Special Forms

2009-09-17 Thread Gorsal
Or maybe i could simply push to the global var and in addition to the value use a unique gensymed id. Then once the local binding was done it would pop until it sees its gensymed id. That would work in the situation that a local binding failed to pop its own binding. That might work... On Sep 17,

Re: Redefining Special Forms

2009-09-17 Thread Gorsal
Thanks for the replies! Before I start doing something silly, I would like to ask another question. The eventual goal of all of this is to establish bindings which also affect the same global variable in other namespaces (these other namespaces will 100% have the same global variable). In other wo

Re: Redefining Special Forms

2009-09-17 Thread Jarkko Oranen
On Sep 17, 7:33 pm, Gorsal wrote: > Basically i need to redefine the meaning of a special form. While i am > willing to change the name for things like ns to defpackage, i am not > willing to change the name of forms like apply and defn to achieve my > goals. Instead, i would like to redefine t

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread rob
My experience so far is that most of the annoying things that get in the way of doing cool Clojure things are due to Java. Things like how classpaths work for example, and permissions. My experience with Java comes from college courses I took about 10 years ago, so the Java level of Clojure can

Re: Modeling question multimethods or methodmaps?

2009-09-17 Thread David Nolen
I believe maps containing functions are generally looked down upon. Multimethods are probably the way to go. Can't you tag your request map with a type? On Thu, Sep 17, 2009 at 7:50 AM, Philipp Meier wrote: > > Hi, > > I'm building a REST server library on top of compojure loosely modeled > after

Re: Modeling question multimethods or methodmaps?

2009-09-17 Thread Philipp Meier
On 17 Sep., 17:49, Stuart Sierra wrote: > On Sep 17, 7:50 am, Philipp Meier wrote: > > > I'm building a REST server library on top of compojure loosely modeled > > after the ideas of erlangs webmachine. The idea is to describe a > > resource using a couple of function which server as decision

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Jim Weirich
On Sep 17, 2009, at 3:44 PM, Daniel wrote: >> As for first books on Java, Look for Bruce Eckel's "Thinking in >> Java" [...] > > [...] If you want an intro to Java that > is not dry and treats you as a reasonably intelligent being, try > 'Thinking in Java'. I would also recommend this book.

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Daniel
On Thu, Sep 17, 2009 at 9:59 PM, Terrance Davis wrote: > > I'll add my two cents. > > You sound like you already program, so basic Java knowledge is useful > with Clojure, but not necessary. You can pick up what you need to know > as you learn Clojure. You will find hooks into Java are a lot more

Re: Anyone care to defend/comment some points in this presentation

2009-09-17 Thread Mark Volkmann
On Thu, Sep 17, 2009 at 1:43 PM, z5h wrote: > > Specifically some problems encountered in Clojure's STM and bytecode > generation. > > http://www.azulsystems.com/events/javaone_2009/session/2009_J1_JVMLang.pdf > (Slide's 8 and 20-21) Slide 20 - Should say "Nothing mutable by default" and "One ki

Re: Redefining Special Forms

2009-09-17 Thread John Harrop
On Thu, Sep 17, 2009 at 2:49 PM, Stuart Sierra wrote: > > On Sep 17, 12:40 pm, Gorsal wrote: > > Oh. And just as a quick other question, do global bindings affect > > threads which are started in the same ns? > > I think threads inherit the bindings in effect when they are created. http://cloju

Anyone care to defend/comment some points in this presentation

2009-09-17 Thread z5h
Specifically some problems encountered in Clojure's STM and bytecode generation. http://www.azulsystems.com/events/javaone_2009/session/2009_J1_JVMLang.pdf (Slide's 8 and 20-21) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

Re: Redefining Special Forms

2009-09-17 Thread Chouser
On Thu, Sep 17, 2009 at 2:49 PM, Stuart Sierra wrote: > > On Sep 17, 12:40 pm, Gorsal wrote: >> Oh. And just as a quick other question, do global bindings affect >> threads which are started in the same ns? > > I think threads inherit the bindings in effect when they are created. They do not, o

Re: Redefining Special Forms

2009-09-17 Thread Laurent PETIT
2009/9/17 Laurent PETIT > > 2009/9/17 Stuart Sierra > >> >> On Sep 17, 12:40 pm, Gorsal wrote: >> > Oh. And just as a quick other question, do global bindings affect >> > threads which are started in the same ns? >> >> I think threads inherit the bindings in effect when they are created. >> > >

Re: Redefining Special Forms

2009-09-17 Thread Laurent PETIT
2009/9/17 Stuart Sierra > > On Sep 17, 12:40 pm, Gorsal wrote: > > Oh. And just as a quick other question, do global bindings affect > > threads which are started in the same ns? > > I think threads inherit the bindings in effect when they are created. > I would not place 1€ on this assumption

Re: Redefining Special Forms

2009-09-17 Thread Stuart Sierra
On Sep 17, 12:40 pm, Gorsal wrote: > Oh. And just as a quick other question, do global bindings affect > threads which are started in the same ns? I think threads inherit the bindings in effect when they are created. -SS --~--~-~--~~~---~--~~ You received this me

Re: Redefining Special Forms

2009-09-17 Thread Stuart Sierra
On Sep 17, 12:33 pm, Gorsal wrote: > Basically i need to redefine the meaning of a special form. This depends on what you want to redefine. True "special forms" in Clojure -- def if do let quote var fn loop recur throw try . new set! -- cannot be redefined, period. Anything else -- the content

Re: Ensure and STM: find the bug...

2009-09-17 Thread Mark Volkmann
On Thu, Sep 17, 2009 at 1:09 PM, John Harrop wrote: > Don't commutes commute with one another, but not with other writes? That's certainly correct from the standpoint of thinking about how commutes get reexecuted during the commit and other writes (from ref-set and alter) do not. Here is how I

Re: Ensure and STM: find the bug...

2009-09-17 Thread John Harrop
Don't commutes commute with one another, but not with other writes? --~--~-~--~~~---~--~~ 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 ne

Re: loop-recur for string handling

2009-09-17 Thread dreish
I think you're looking for something more like this: (use '[clojure.contrib.str-utils :only (str-join)]) (def mystr "the quick brown fox") (defn split-at-word [text keyword] (str-join " " (drop-while (partial not= keyword) (re-seq #"\w+" text user=> (split

Re: loop-recur for string handling

2009-09-17 Thread Baishampayan Ghose
Aridaman Pandit wrote: > Thanks for the reply. I understand the code that you have given. > Actually I also wanted it to be stored into some variable (if not the > same) everytime I run it. > Suppose I am matching for keyword "brown" and I want to store > everything after "brown". So for that purpo

Re: Ensure and STM: find the bug...

2009-09-17 Thread Chouser
On Thu, Sep 17, 2009 at 1:25 PM, Mark Volkmann wrote: > > On Thu, Sep 17, 2009 at 11:12 AM, John Harrop wrote: >> >> Not with ref-set! or alter!, but maybe with commute identity? > > I should have been more clear above. What I meant was that multiple > concurrent transactions cannot write the sa

A welcome

2009-09-17 Thread Wojciech Kaczmarek
Hi folks! I just subscribed to this list and hope we gain some hacking experience together. I walked a long way since I decided to go beyond OO: rediscovered CL, then went to ML family for a couple of years, then Haskell, and back to dynamic setting via Erlang to Lisps of today. I consider mysel

Re: Ensure and STM: find the bug...

2009-09-17 Thread Mark Volkmann
On Thu, Sep 17, 2009 at 11:12 AM, John Harrop wrote: > On Thu, Sep 17, 2009 at 11:04 AM, Mark Volkmann > wrote: >> >> On Thu, Sep 17, 2009 at 9:57 AM, Chouser wrote: >> > >> > On Thu, Sep 17, 2009 at 12:28 AM, Krukow wrote: >> >> >> >> Final question. The docs say that 'ensure' permits more co

Re: Ensure and STM: find the bug...

2009-09-17 Thread John Harrop
On Thu, Sep 17, 2009 at 11:04 AM, Mark Volkmann wrote: > On Thu, Sep 17, 2009 at 9:57 AM, Chouser wrote: > > > > On Thu, Sep 17, 2009 at 12:28 AM, Krukow wrote: > >> > >> Final question. The docs say that 'ensure' permits more concurrency > >> than promoting the ref to a write. Is there a quick/

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Brian
As a Java programmer coming to Clojure I would be very interested in the intended application. How you approach that from a Clojure perspective is what I'm interested in. I've programmed in Lisp in the distant past (Symbolics Lisp machines) and still have very found memories of that environment.

Re: Redefining Special Forms

2009-09-17 Thread Gorsal
Oh. And just as a quick other question, do global bindings affect threads which are started in the same ns? Like (binding [*global* 2] (with-thread (print *global*) ;;prints 2??? )) On Sep 17, 11:33 am, Gorsal wrote: > Basically i need to redefine the meaning of a special form. While i

Redefining Special Forms

2009-09-17 Thread Gorsal
Basically i need to redefine the meaning of a special form. While i am willing to change the name for things like ns to defpackage, i am not willing to change the name of forms like apply and defn to achieve my goals. Instead, i would like to redefine them for my own needs. Of course, i will be us

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Brenton
Java does get a bad rap these days and it can be difficult to spend time learning something that you are not excited about. Here is a little more encouragement. I was recently working on a Project Euler problem involving prime number generation. My initial pure Clojure implementation took about 1

Re: Cells for Clojure

2009-09-17 Thread Stuart Sierra
On Sep 11, 7:55 pm, Fogus wrote: > Even more information here: > https://www.assembla.com/spaces/clojure-contrib/tickets/19-Re-add-auto-agent-clj I should point out that auto-agents, which I wrote, is NOT Cells. It's just a quick hack that I whipped up as an example of using watchers. The origi

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Stuart Sierra
On Sep 16, 10:46 pm, Hugh Aguilar wrote: > My concern right now is that I don't know Java. Is this a prerequisite > for learning Clojure? Can I program in Clojure without delving into > Java, or are there certain things that will require Java? Yes, you can learn Clojure the language without know

Re: Modeling question multimethods or methodmaps?

2009-09-17 Thread Stuart Sierra
On Sep 17, 7:50 am, Philipp Meier wrote: > I'm building a REST server library on top of compojure loosely modeled > after the ideas of erlangs webmachine. The idea is to describe a > resource using a couple of function which server as decision makers > for the different stages of HTTP request pro

Re: Ensure and STM: find the bug...

2009-09-17 Thread Chouser
On Thu, Sep 17, 2009 at 12:28 AM, Krukow wrote: > > Final question. The docs say that 'ensure' permits more concurrency > than promoting the ref to a write. Is there a quick/simple way of > explaining how? (Or do I need to go to the source :-) If you have multiple transactions ensuring the same

Re: Ensure and STM: find the bug...

2009-09-17 Thread Mark Volkmann
On Thu, Sep 17, 2009 at 9:57 AM, Chouser wrote: > > On Thu, Sep 17, 2009 at 12:28 AM, Krukow wrote: >> >> Final question. The docs say that 'ensure' permits more concurrency >> than promoting the ref to a write. Is there a quick/simple way of >> explaining how? (Or do I need to go to the source

Re: Ensure and STM: find the bug...

2009-09-17 Thread Mark Volkmann
On Wed, Sep 16, 2009 at 11:28 PM, Krukow wrote: > > Final question. The docs say that 'ensure' permits more concurrency > than promoting the ref to a write. Is there a quick/simple way of > explaining how? (Or do I need to go to the source :-) When you call ensure on a Ref, the current LockingTr

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Terrance Davis
I'll add my two cents. You sound like you already program, so basic Java knowledge is useful with Clojure, but not necessary. You can pick up what you need to know as you learn Clojure. You will find hooks into Java are a lot more pleasant than interfacing with C and C++. I'm saying that one f

Re: loop-recur for string handling

2009-09-17 Thread Aridaman Pandit
Hi Thanks for the reply. I understand the code that you have given. Actually I also wanted it to be stored into some variable (if not the same) everytime I run it. Suppose I am matching for keyword "brown" and I want to store everything after "brown". So for that purpose I wanted to chop off ever

Re: loop-recur for string handling

2009-09-17 Thread Baishampayan Ghose
Aridaman, > I am very new to clojure and have worked previously on C/C++ > > I wanted to do some string operations, where I can match occurrence of > a particular string. However, I get this error everytime. > > java.lang.ClassCastException: clojure.lang.Var cannot be cast to > java.lang.CharSeq

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Hugh Aguilar
Thanks for the encouragement. I've already got the book. I suppose eventually I will have to learn Java. I have been putting it off because I hear a lot of Java-bashing from programmers, and have also noted that this is generally the impetus for the development of languages such as Clojure and Sc

loop-recur for string handling

2009-09-17 Thread Aridaman Pandit
Hi everyone I am very new to clojure and have worked previously on C/C++ I wanted to do some string operations, where I can match occurrence of a particular string. However, I get this error everytime. java.lang.ClassCastException: clojure.lang.Var cannot be cast to java.lang.CharSequence (myse

Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Michael Kohl
On Thu, Sep 17, 2009 at 4:46 AM, Hugh Aguilar wrote: > My concern right now is that I don't know Java. Is this a prerequisite > for learning Clojure? Can I program in Clojure without delving into > Java, or are there certain things that will require Java? I for example am not really big on Java

Modeling question multimethods or methodmaps?

2009-09-17 Thread Philipp Meier
Hi, I'm building a REST server library on top of compojure loosely modeled after the ideas of erlangs webmachine. The idea is to describe a resource using a couple of function which server as decision makers for the different stages of HTTP request processing. There will be a function to determin

Re: clojure-test-mode overlays

2009-09-17 Thread Rick Moynihan
2009/9/17 Phil Hagelberg : > > Rick Moynihan writes: > >> I'm using the latest clojure-mode with slime, (setup through >> clojure-install) and have started playing with clojure-test-mode. >> >> Unfortunately it doesn't appear to display the test results >> anywhere...  Though it does appear to ru

Re: Ensure and STM: find the bug...

2009-09-17 Thread Christian Vest Hansen
On Thu, Sep 17, 2009 at 6:28 AM, Krukow wrote: > > > > On Sep 16, 10:06 pm, Rich Hickey wrote: >> On Sep 16, 11:39 am, Stuart Halloway >> wrote: >> >> > The docs could be more clear, but if validate-fn must be side effect >> > free then it certainly can't look at any other refs. >> >> Yes. The