Re: clojure vs scala

2009-08-27 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 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" g

I18n

2009-08-27 Thread ngocdaothanh
Hi all, Is there an i18n library for Clojure? What Java i18n library should I use in a Clojure program (it suits Clojure syntax for example)? For Ruby and Erlang I prefer Gettext, but for Java it seems that .properties files are in major use. Thanks, Ngoc. --~--~-~--~~~-

Re: clojure vs scala

2009-08-27 Thread e
On Thu, Aug 27, 2009 at 9:57 AM, Emeka wrote: > e, > > What is inspiring in it? > H from time to time, people use percent literacy as a measure of public intellectual health, right? In that case, it's sort of obvious that literacy is a goal. Well, I'm wondering if we need to add a 4t

Re: How about write clojure code like python mode?

2009-08-27 Thread Daniel Lyons
On Aug 27, 2009, at 9:45 AM, Richard Newman wrote: > One reason for it not catching on is probably that anyone who's > learned enough Lisp to implement it has become comfortable enough with > parens to not use it. The same applies for the newbie who decides to > learn enough to start implementin

Re: Why doesn't regex implement ifn?

2009-08-27 Thread Chas Emerick
On Aug 27, 2009, at 1:34 PM, Chouser wrote: > The benefits of #"" producing a real java.util.regex.Pattern > object instead of some Clojury wrapper will decrease as it > becomes more common to write Clojure code that can run on > non-JVM platforms. So although this idea has come up and > then b

Re: Why doesn't regex implement ifn?

2009-08-27 Thread Timothy Pratley
> > The only feature I want is the ability to use a regex as a predicate. > Would automatically forcing the first step to get a nice 'nil' be >unacceptable? Sounds good to me! This can be quite easily accommodated: (defn re-fn "Construct a regular expression from string. Calling a regular e

Re: Lazy Exceptions

2009-08-27 Thread eyeris
When you say "the original" do you mean the outer-most RuntimeException or the inner-most exception? On Aug 27, 8:33 am, Meikel Brandmeyer wrote: > Hi, > > On Aug 27, 5:47 am, Tim Snyder wrote: > > > > > I'm trying to understand how laziness affects exception handling.  I > > keep finding my e

Re: Why doesn't regex implement ifn?

2009-08-27 Thread Sean Devlin
Awesome. +1 On Aug 27, 9:57 pm, Timothy Pratley wrote: > > > The only feature I want is the ability to use a regex as a predicate. > > Would automatically forcing the first step to get a nice 'nil' be > >unacceptable? > > Sounds good to me! > This can be quite easily accommodated: > > (defn re

Re: Enumerate namespaces

2009-08-27 Thread Laurent PETIT
Hi, If you AOT compile the clojure webapp in a jar, you're presumably in a preproduction or production delivery process, and there I guess things will not be very dynamic anymore. Then, you could consider adding to your AOT compilation script to create a summary of all your controllers in a genera

Re: Lazy Exceptions

2009-08-27 Thread Tim Snyder
Well, I can see that LazySeq does indeed catch and wrap all Exceptions in a RuntimeException. I also think I can work around it, but I'd like to know why this was done? Was it necessary given the checked vs. unchecked exception system of Java? Is it because the exception generated by a lazy seq

[job-posting] Runa looking for Clojure developers

2009-08-27 Thread Amit Rathore
Hi folks, We, Runa (runa.com), are looking for great developers to join our small team. We’re an early stage, pre-series-A startup (presently funded with strategic investments from two large corporations) playing in the e-commerce space. We’re creating a new product in the small-to- medium

Re: Why doesn't regex implement ifn?

2009-08-27 Thread Sean Devlin
Hmmm... I think you're confusing the issue. Your compliant seems to be more directed at "magic numbers" than regexes. If I understand your argument (which I agree with): ;bad code (filter #"\d+" maybe-numbers) ;good code (let [is-number-regex #"\d+"] (filter is-number-regex maybe-numbers))

Re: Order of keys within a map?

2009-08-27 Thread Sean Devlin
Howard, I ran into the exact same problem. Check out the discussion on fn- tuple here: http://groups.google.com/group/clojure-dev/browse_thread/thread/155c8b9893d673bc# This should do what you need. Sean On Aug 27, 3:35 pm, Howard Lewis Ship wrote: > Is the order of keys in a map predictabl

Re: Lazy Exceptions

2009-08-27 Thread Nik Kolev
Apache's commons-lang library has a utility class that has a decent amount of functionality for dissecting exception stacks/traces (getRootCause() maybe what you want): http://commons.apache.org/lang/api/org/apache/commons/lang/exception/ExceptionUtils.html On Thu, Aug 27, 2009 at 10:03 AM, Tim Sny

Enumerate namespaces

2009-08-27 Thread ngocdaothanh
Hi all, To have dynamic to study Clojure, I would like to create a pluggable (like Rails Engines) web framework based on Compojure. It will add some conventions like: * Controllers files are prefixed with "c-", ex: src/main/clojure/myapp/ c-article.clj * To make controllers pluggable, routes are

Re: Order of keys within a map?

2009-08-27 Thread Christophe Grand
On Thu, Aug 27, 2009 at 9:35 PM, Howard Lewis Ship wrote: > Literally: when iterating over the key/value pairs, the order seems to > be the order in which the key/values are defined in the map. Is this > true? user=> {"0" 0 "1" 1 "2" 2 "3" 3 "4" 4 "5" 5 "6" 6 "7" 7 "8" 8 "9" 9 "10" 10 "11" 11 "

Re: Order of keys within a map?

2009-08-27 Thread Jeremy Gailor
Traditionally, there is no guarantee for the sorting order of keys in a map. There are sorted map implementations around though if you are in need of this functionality (I'm not sure if there is a Clojure sorted map, but the algorithm is out there). On Thu, Aug 27, 2009 at 12:35 PM, Howard Lewis

Re: Order of keys within a map?

2009-08-27 Thread Richard Newman
> Literally: when iterating over the key/value pairs, the order seems to > be the order in which the key/values are defined in the map. Is this > true? For small numbers of keys (<7 I think) they're stored in a linear format (analogous to an associative list), and the insertion order is effec

Re: Why doesn't regex implement ifn?

2009-08-27 Thread Chouser
On Thu, Aug 27, 2009 at 11:41 AM, Sean Devlin wrote: > > On Aug 27, 1:06 am, Timothy Pratley wrote: >> >>  If #"X" created a (re-fn "X") then all the re functions could accept >> a function and call it in order to avoid having to do (re-find (pp) >> s). The previous signature could be retained so

Re: Order of keys within a map?

2009-08-27 Thread John Harrop
On Thu, Aug 27, 2009 at 3:35 PM, Howard Lewis Ship wrote: > > Is the order of keys in a map predictable? I have some tests I'm > concerned about, where the keys and values in a map are converted to a > string (ultimately, a URL, as query parameters) and the order will > affect the output string.

Re: Why doesn't regex implement ifn?

2009-08-27 Thread Sean Devlin
Or this: (def number-text? #"^\d$") Which is a savings :) On Aug 27, 5:21 pm, eyeris wrote: > I named is-number-regex poorly. I meant it to be a function that calls > re-matches. Here's a more complete snippet, with better names: > > ; bad code > (filter #"^\d+$" maybe-numbers) > > ; good code

Re: Order of keys within a map?

2009-08-27 Thread Richard Newman
> Key order is preserved for array-maps. Map literals up to 8 pairs > are array-maps. Beginning with 9 pairs you get a hash-map. I'm not > aware of a rule how to determine the order of keys of a hash-map. > This is implementation specific, I would assume. (Thus can change at > any arbitrar

Re: Order of keys within a map?

2009-08-27 Thread Meikel Brandmeyer
Hi, Am 27.08.2009 um 21:35 schrieb Howard Lewis Ship: Is the order of keys in a map predictable? I have some tests I'm concerned about, where the keys and values in a map are converted to a string (ultimately, a URL, as query parameters) and the order will affect the output string. I could so

Re: Why doesn't regex implement ifn?

2009-08-27 Thread eyeris
I named is-number-regex poorly. I meant it to be a function that calls re-matches. Here's a more complete snippet, with better names: ; bad code (filter #"^\d+$" maybe-numbers) ; good code (defn re-match? [re s] (not (nil? (re-matches re s (defn number-text? [s] (re-match? #"^\d+$" s)) (filt

Re: Order of keys within a map?

2009-08-27 Thread Patrick Sullivan
If you look at the data_structures page on clojure.org you'll see there are sorted maps available to allow guarantees of being sorted by Key. ~Patrick On Aug 27, 1:40 pm, Jeremy Gailor wrote: > Traditionally, there is no guarantee for the sorting order of keys in a map. > > There are sorted map

Order of keys within a map?

2009-08-27 Thread Howard Lewis Ship
Is the order of keys in a map predictable? I have some tests I'm concerned about, where the keys and values in a map are converted to a string (ultimately, a URL, as query parameters) and the order will affect the output string. I could sort the keys, but then I'm changing my code to support the

Re: How about write clojure code like python mode?

2009-08-27 Thread Richard Newman
One reason for it not catching on is probably that anyone who's learned enough Lisp to implement it has become comfortable enough with parens to not use it. The same applies for the newbie who decides to learn enough to start implementing... The same goes for infix (particularly infix math)

Re: clojure vs scala

2009-08-27 Thread Fogus
RE (1) --- Agreed on all points. Clojure seems to have captured a large share of excitement and the effort put into the community documentation [1] is staggering and only set to get better. I liken the excitement behind Clojure to that behind Ruby (minus the drama). More and more people are

Re: Why doesn't regex implement ifn?

2009-08-27 Thread Sean Devlin
On Aug 27, 1:06 am, Timothy Pratley wrote: > > Granted, this wouldn't work for anything that gets passed to Java, but > > the following gist would be a start. > >http://gist.github.com/176032 > > You already have a getPattern method for those cases. Which suggests > another solution: > > (defn re

Re: clojure vs scala

2009-08-27 Thread Emeka
e, What is inspiring in it? Regards, Emeka On Thu, Aug 27, 2009 at 1:44 PM, e wrote: > On Thu, Aug 27, 2009 at 8:43 AM, Stuart Halloway < > stuart.hallo...@gmail.com> wrote: > >> >> As the author of the book, you can bet I have an opinion on the >> quality of the docs. :-) >> >> (1) I think t

Re: Lazy Exceptions

2009-08-27 Thread Tim Snyder
Thanks for the replies. I'll have a look at the impl. of LazySeq tonight and see if that helps. It sounds like it shouldn't be a problem to work around though. Is there somewhere I can read that gives an explanation or information about why this is done? On Aug 27, 9:33 am, Meikel Brandmeyer

Re: clojure vs scala

2009-08-27 Thread e
On Thu, Aug 27, 2009 at 8:43 AM, Stuart Halloway wrote: > > As the author of the book, you can bet I have an opinion on the > quality of the docs. :-) > > (1) I think the documentation for Clojure (website, Mark Volkmann's > long article [1], blog posts, the book [2]) is *insanely* good, given > h

Re: Lazy Exceptions

2009-08-27 Thread Meikel Brandmeyer
Hi, On Aug 27, 5:47 am, Tim Snyder wrote: > I'm trying to understand how laziness affects exception handling.  I > keep finding my exceptions wrapped in RuntimeExceptions. > > If I have code that just throws an exception, I get what I'd expect: > (throw (Exception. "Plain Exception")) --> > Plai

Re: Java STM

2009-08-27 Thread Rich Hickey
On Aug 27, 7:17 am, peter veentjer wrote: > Hi Christian, > > On Jul 13, 10:37 am, Christian Vest Hansen > wrote: > > > I believe that DeuceSTM i primarily intended as a research platform > > for Java STMs, hence the flexibility with pluggable algorithms. > > > Another Java STM is multiverse:h

Re: Lazy Exceptions

2009-08-27 Thread Dan Fichter
Lazy seqs were designed to work that way. See the implementation in clojure.lang.LazySeq. RuntimeExceptions get thrown whenever Exceptions are caught. I guess you find it unhelpful? Dan On Wed, Aug 26, 2009 at 11:47 PM, Tim Snyder wrote: > > I'm trying to understand how laziness affects exce

Re: clojure vs scala

2009-08-27 Thread Stuart Halloway
As the author of the book, you can bet I have an opinion on the quality of the docs. :-) (1) I think the documentation for Clojure (website, Mark Volkmann's long article [1], blog posts, the book [2]) is *insanely* good, given how young the language is. But... (2) If you are coming from a

Lazy Exceptions

2009-08-27 Thread Tim Snyder
I'm trying to understand how laziness affects exception handling. I keep finding my exceptions wrapped in RuntimeExceptions. If I have code that just throws an exception, I get what I'd expect: (throw (Exception. "Plain Exception")) --> Plain Exception [thrown class java.lang.Exception] On the

Re: Java STM

2009-08-27 Thread peter veentjer
Hi Christian, On Jul 13, 10:37 am, Christian Vest Hansen wrote: > I believe that DeuceSTM i primarily intended as a research platform > for Java STMs, hence the flexibility with pluggable algorithms. > > Another Java STM is multiverse:http://code.google.com/p/multiverse/- > the focus here is on

Re: A little help needed in understnding anonymous functions

2009-08-27 Thread Sourav
I knew I was missing something...!! Thanks all for your help! :) On Aug 27, 12:19 am, Scott Moonen wrote: > Hi Soura.  I think you have an extra set of parentheses in your second > example, on the line with dosync.  It should read: > > (defn foo2 [n] >  (let [r (ref n)] >    #(dosync >        (a

Re: Cambridge (UK) Informal Clojure UG meetup

2009-08-27 Thread Jim Downing
Correction: That's *Tuesday* 1st September... 2009/8/27 Jim Downing : > Hi all, > > I'm meeting up with a few folks to chat about Clojure over a few beers > next Monday evening at 8pm in the Kingston Arms, Cambridge (UK). > Additional company very welcome! > > http://jimdowning.wordpress.com/2009

Cambridge (UK) Informal Clojure UG meetup

2009-08-27 Thread Jim Downing
Hi all, I'm meeting up with a few folks to chat about Clojure over a few beers next Monday evening at 8pm in the Kingston Arms, Cambridge (UK). Additional company very welcome! http://jimdowning.wordpress.com/2009/08/27/cambridge-clojure-user-group-meeting/ Cheers, jim --~--~-~--~~

Re: Newbie Eclipse REPL question

2009-08-27 Thread Laurent PETIT
Sorry, I still have difficulties to understand the use case. Maybe you could elaborate on what you think a programming session with this feature could be. Anyway, for the moment you could still use (System/exit 0), but I'm rather sure it's too simplistic and misses the point you're trying to expla