Re: swap! and dosync

2009-10-07 Thread Krukow
On Oct 8, 3:43 am, Timothy Pratley wrote: > Atoms can't do this, as they are synchronous (called and returned > immediately) - hence the warning about potentially being called > multiple times. The reason that swap! may "fail" is that it is performing a compare- and-swap operation which may fa

Re: ANN: scriptjure, a library for generating javascript

2009-10-07 Thread Meikel Brandmeyer
Hi, On Oct 8, 7:50 am, Jarkko Oranen wrote: > I took a quick look, and that looks really neat. One thing though: > Instead of the "clj" form to escape back to clojure, why not just use > "unquote" (and possibly unquote-splicing)? that would allow you to use > the ~ reader macro as a shortcut, j

Re: Basic questions

2009-10-07 Thread Baishampayan Ghose
vishy wrote: > Hi, > > How can I find out all the namespaces in a library like > clojure.contrib.Also, how to find all the functions defined in a > namespace? Are there any commands which I can use on commandline? http://richhickey.github.com/clojure-contrib/ Hope that helps. Regards, BG -- B

Re: ANN: scriptjure, a library for generating javascript

2009-10-07 Thread Jarkko Oranen
On Oct 8, 5:01 am, Allen Rohner wrote: > Hello, I'd like to announce the availability of a new library, called > Scriptjure. It's a macro that generates javascript strings from > Clojure s-exprs. My initial use for it is in glue code for Clojure > webapps. For example: > >  (js (fn foo [x] >    

Basic questions

2009-10-07 Thread vishy
Hi, How can I find out all the namespaces in a library like clojure.contrib.Also, how to find all the functions defined in a namespace? Are there any commands which I can use on commandline? thanks --~--~-~--~~~---~--~~ You received this message because you are su

ANN: scriptjure, a library for generating javascript

2009-10-07 Thread Allen Rohner
Hello, I'd like to announce the availability of a new library, called Scriptjure. It's a macro that generates javascript strings from Clojure s-exprs. My initial use for it is in glue code for Clojure webapps. For example: (js (fn foo [x] (var y 3) (return (+ x y => "funct

Re: swap! and dosync

2009-10-07 Thread Timothy Pratley
Yup that's correct. "Agents are integrated with the STM - any dispatches made in a transaction are held until it commits, and are discarded if it is retried or aborted." http://clojure.org/agents Atoms can't do this, as they are synchronous (called and returned immediately) - hence the warning a

Re: swap! and dosync

2009-10-07 Thread Stuart Halloway
Atoms do not coordinate in any way with refs or with agents. Their purpose is to be *independent* of other state. Cheers, Stu > > IIRC, dispatching to agents (via send or send-off) during a > dosynconly happens if the transaction was successful (this was > discussed in > several places, th

swap! and dosync

2009-10-07 Thread pmf
IIRC, dispatching to agents (via send or send-off) during a dosync only happens if the transaction was successful (this was discussed in several places, though http://clojure.org/refs does not mention this; maybe this should be included there, if this is really something that is guaranteed). I'd

Re: where's clojure.contrib.walk?

2009-10-07 Thread paul wisehart
On Oct 7, 3:13 pm, pkw wrote: > I want to use stringify-keys, what am i missing? > thanks, nevermind, it's not in contrib: (clojure.walk/stringify-keys {:asd "asd"}) ;; works fine --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

where's clojure.contrib.walk?

2009-10-07 Thread pkw
I want to use stringify-keys, what am i missing? thanks, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members a

Re: read-line in emacs slime on windows problem

2009-10-07 Thread Phil Hagelberg
Jason Wolfe writes: > Happens for me too, on OS X. I always just switch to the *inferior- > lisp* REPL (C-s i) before starting any commands that expect user > input. Yeah, this is not a platform-specific problem; it's simply not supported in swank-clojure. I'd love to get a patch to fix this,

Re: read-line in emacs slime on windows problem

2009-10-07 Thread Jason Wolfe
Happens for me too, on OS X. I always just switch to the *inferior- lisp* REPL (C-s i) before starting any commands that expect user input. -Jason On Oct 7, 3:37 am, Kelvin Ward wrote: > Just to update, I've confirmed that this also happens on Ubuntu Linux. > I did a fresh install of ubuntu an

Re: immutable defs?

2009-10-07 Thread Stephen C. Gilardi
On Oct 7, 2009, at 12:47 AM, Mark Tomko wrote: This is pretty much what I'd had in mind. Thanks for the comments and suggestions all. I don't see how the text of the Exception is set by the macro, but it'd be really spectacular if the message were more clear. Is that message coming from th

Re: immutable defs?

2009-10-07 Thread Stephen C. Gilardi
On Oct 7, 2009, at 5:19 AM, Meikel Brandmeyer wrote: Or is setting the validator calling it on the already set value? Yes, the validation mechanism calls the validator on the already set value. --Steve smime.p7s Description: S/MIME cryptographic signature

Light Clojure contract work available for someone residing in Minneapolis/St. Paul

2009-10-07 Thread Conrad
Please only contact me if you are a current resident of the Twin Cities area. We want someone who is available for face-to-face meetings. con...@zipnosis.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" g

[OT] Re: Unable to use contrib

2009-10-07 Thread Baishampayan Ghose
Abhishek Reddy wrote: > The semicolon character opens a single-line comment in Clojure (as is > traditional in lisp languages). It's like // in Java. Off topic: Abhishek, so have you switched from CL to Clojure now? ;) Anyway, have loads of fun. I am. Regards, BG -- Baishampayan Ghose oCric

Re: Agent send-off: ~20k/s

2009-10-07 Thread MarkSwanson
On Oct 7, 2:59 am, ngocdaothanh wrote: > Mark, > What tool did you use to see the CPU utilization, especially when the > test run time is so short? > > Just curious. I used the CPU utilization monitor in Linux. I adjusted the loop so it took about 5-7 seconds. --~--~-~--~~

Re: Strange nullpointer when seqing through an xml

2009-10-07 Thread pmf
On Oct 7, 10:50 am, Hans Sjunnesson wrote: > The following code works fine: > (doseq [x (xml-seq foo)] (println x)) > > However when I want to do more things in the doseq body, or I simply > add an extra set of parentheses around the println statement, I get a > nullpointer. > (doseq [x (xml-seq

Re: Strange nullpointer when seqing through an xml

2009-10-07 Thread Meikel Brandmeyer
Hi, On Oct 7, 10:50 am, Hans Sjunnesson wrote: > However when I want to do more things in the doseq body, or I simply > add an extra set of parentheses around the println statement, I get a > nullpointer. > (doseq [x (xml-seq foo)] ((println x))) Just do multiple things in the doseq body: (do

Strange nullpointer when seqing through an xml

2009-10-07 Thread Hans Sjunnesson
The following code works fine: (doseq [x (xml-seq foo)] (println x)) However when I want to do more things in the doseq body, or I simply add an extra set of parentheses around the println statement, I get a nullpointer. (doseq [x (xml-seq foo)] ((println x))) java.lang.NullPointerException (NO_

Re: Linear Algebra Package

2009-10-07 Thread liebke
Hi Patrick, Unfortunately, Incanter doesn't have any convolution functions, and I'm not sure Parallel Colt does either. So I think you'll need to roll your own. You can find the Incanter API docs here: http://incanter.org/docs/api/ and the Parallel Colt API docs here: http://incanter.org/docs/pa

Re: Tetris

2009-10-07 Thread Timothy Pratley
On Oct 7, 1:04 pm, Zach Tellman wrote: > I've thrown together a very simple Tetris clone I love it! Really great :) PS: for others who want to try it, all the dependencies are bundled in the lib directory - you just add them to your CLASSPATH and LD_LIBRARY_PATH and it all just works! (I only

Re: immutable defs?

2009-10-07 Thread Laurent PETIT
2009/10/7 Stephen C. Gilardi > On Oct 2, 2009, at 10:29 AM, Mark wrote: > > Is there a way to make a declaration in Clojure that cannot be rebound >> later? Ideally, I'd like something that fails if I try to do this: >> >> (def myname "mark") >> ; ...more code, elided... >> (def myname "Mark")

Re: immutable defs?

2009-10-07 Thread Laurent PETIT
2009/10/7 Stephen C. Gilardi > On Oct 2, 2009, at 10:29 AM, Mark wrote: > > Is there a way to make a declaration in Clojure that cannot be rebound >> later? Ideally, I'd like something that fails if I try to do this: >> >> (def myname "mark") >> ; ...more code, elided... >> (def myname "Mark")

Re: Unable to use contrib

2009-10-07 Thread Abhishek Reddy
The semicolon character opens a single-line comment in Clojure (as is traditional in lisp languages). It's like // in Java. On Wed, Oct 7, 2009 at 11:08 PM, vishy wrote: > > thanks for the comprehensive answer,clarified everything :) > But, why ;; at the end? > > On Oct 7, 11:17 am, Abhishek R

Re: read-line in emacs slime on windows problem

2009-10-07 Thread Kelvin Ward
Just to update, I've confirmed that this also happens on Ubuntu Linux. I did a fresh install of ubuntu and followed the guide at: http://riddell.us/tutorial/slime_swank/slime_swank.html I also tried the emacs starter kit approach at: http://technomancy.us/126 On the bright side, whilst read-line

Re: Unable to use contrib

2009-10-07 Thread vishy
thanks for the comprehensive answer,clarified everything :) But, why ;; at the end? On Oct 7, 11:17 am, Abhishek Reddy wrote: > On Wed, Oct 7, 2009 at 5:57 PM, Mark Reid wrote: > > I'm not sure if this is the "best" approach but I found that if you > > >    (use 'clojure.contrib.math) > > > ins

Re: immutable defs?

2009-10-07 Thread Meikel Brandmeyer
Hi, On Oct 7, 7:53 am, John Harrop wrote: > On Tue, Oct 6, 2009 at 9:14 PM, Stephen C. Gilardi wrote: > > >     `(do (set-validator! (defvar ~name ~init) #{~init}) (var ~name))) > > Cute hack. Won't work if init is false or nil, though, unless the validator > does not trigger on the initial ass

Re: immutable defs?

2009-10-07 Thread John Harrop
On Tue, Oct 6, 2009 at 9:14 PM, Stephen C. Gilardi wrote: > `(do (set-validator! (defvar ~name ~init) #{~init}) (var ~name))) > Cute hack. Won't work if init is false or nil, though, unless the validator does not trigger on the initial assignment of the value. --~--~-~--~~--

Re: Unable to use contrib

2009-10-07 Thread Wei Yuan Cai
Hello, Try (clojure.contrib.math/lcm 4 5) Regards Wei Weiyuan wrote On 07-Oct-2009, at 12:36 PM, vishy wrote: > > Hi, > > I am on windows machine. I am using these commands to startup clojure, > but not able to use functions from contrib library. > > java -cp clojure.jar;clojure-contrib.jar

Re: Agent send-off: ~20k/s

2009-10-07 Thread ngocdaothanh
Mark, What tool did you use to see the CPU utilization, especially when the test run time is so short? Just curious. On Oct 7, 12:58 pm, MarkSwanson wrote: > > (You wrote "atom" several times but I guess you meant "agent".) > > Heh heh... yeah. --~--~-~--~~~---~--~-