Re: extending types

2011-05-19 Thread Ken Wesson
On Fri, May 20, 2011 at 2:54 AM, Ken Wesson  wrote:
> => (def r (put (DateMap. {}) :foo (java.util.Date.)))
> #'user/r
> => r
> {:foo "Thu May 19 22:44:37 PDT 2011"}
> => (get-as-date r :foo)
> #

Bah, copy and paste error. Test it and you'll find it works
regardless. Somehow I got the result from (get-as-date q :foo) copied
here, but with that value of :foo in r (get-as-date r :foo) yields
22:44:37.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: extending types

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 11:26 PM, Lachlan  wrote:
> Just working through this, if we take your example above, what if I
> wanted to override the 'put' method rather than define a new one,
> since we don't have access to 'proxy-super'.  For example making a map
> that enforces storage of dates in a string format - something like:
>
> (defprotocol DMap (put [this o1 o2]) (get-as-date [this o1]))
>
> (extend-type clojure.lang.PersistentArrayMap
>   NPut
>   (put [this o1 o2] (if (::datestore (meta this)) (super put o1
> (format-date-to-string o2)) (super put o1 o2)))
>   (get-as-date [this o1] (if (::datestore (meta this)) (parse-date
> (super get o1)) (super get o1)))
>
> and get will return the string formatted version
>
> or another example could be forcing all keys to be keywords, even if
> they are provided as a string or symbol, without having to write
> (assoc {} (keyword k) v) all the time.
>
> the other motivation would be to be able to throw exceptions on
> invalid input into a map or vector, rather than debugging involving
> 'why the hell has that map got an xxx in it!' when after much
> searching it turns out i've got some function arguments around the
> wrong way :)

Several suggestions:

First, you may want to solve some of these issues by providing your
own functions (and possibly using protocols and extend-type to make
them polymorphic) that do what you want. In Clojure, behavior (and
decisions about what works with which objects) tends to be in
functions, not the objects themselves. So you can make this for
instance:

(defn assoc-k [m k v]
  (let [k (if (keyword? k) k (keyword (str k)))]
(assoc m k v)))

For validation you could make an assoc-v that checks the map's
metadata for a validation function and calls it on the key and value,
then calls assoc. The validation function throws an exception if it
doesn't like the kv pair. Or, if the maps will be in refs, atoms, or
similarly, you can attach validators to those that check the whole map
(and can enforce multi-key constraints).

For the big guns, you can also use deftype on clojure.lang.Associative
or clojure.lang.IPersistentMap to make map-like objects with
overridden assoc and other methods. You tried that above, but hoping
to extend PersistentArrayMap and call super. Instead, implement
IPersistentMap and delegate by having an internal map object, e.g.

(defn format-date-to-string [obj]
  (if (instance? java.util.Date obj)
(str obj)
obj))

(defn parse-date [obj]
  (if (string? obj)
(try
  (java.util.Date. (java.util.Date/parse obj))
  (catch IllegalArgumentException _ obj))
obj))

(defprotocol DMap
  (put [this k v])
  (get-as-date [this k]))

(deftype DateMap [m]
  clojure.lang.IPersistentMap
  ; implement methods to delegate to m
  ; and wrap return in (DateMap. ...)
  ; but maybe punt assoc to put and get to
  ; get-as-date instead.
  (assoc [this k v]
(DateMap.
  ; (assoc m k (format-date-to-string v
(assoc m k v)))
  (without [this k]
(DateMap. (dissoc m k)))
  (assocEx [this k v]
(DateMap.
  ; (.assocEx m k (format-date-to-string v
(.assocEx m k v)))
  (iterator [this] (.iterator m))
  (containsKey [this k] (.containsKey m k))
  (entryAt [this k] (first {k (get this k)}))
  (count [this] (count m))
  (cons [this [k v]] (assoc this k v))
  (empty [this] (DateMap. (with-meta {} (meta m
  (equiv [this obj] (= m obj))
  (seq [this]
(seq (zipmap (keys m) (map this (keys m)
  (valAt [this k] (.valAt this k nil))
  (valAt [this k not-found]
(if-let [[_ v] (find m k)]
  ; (parse-date (m k not-found))
  v
  not-found))
  clojure.lang.IObj ; Let DateMap have metadata
  (meta [this] (meta m))
  (withMeta [this md] (DateMap. (with-meta m md)))
  clojure.lang.IFn
  (invoke [this k] ; Make DateMap a function
(get this k))  ; of its keys like normal maps
  (invoke [this k not-found]
(get this k not-found))
  DMap
  (put [this k v]
(DateMap. (assoc m k (format-date-to-string v
  (get-as-date [this k]
(parse-date (m k

(extend-type clojure.lang.APersistentMap
  ; Should catch PersistentArrayMap, PersistentHashMap, etc.
  DMap
  (put [this k v]
(assoc this k v))
  (get-as-date [this k]
(this k)))

which works:

=> (def q (put {} :foo (java.util.Date.)))
#'user/q
=> q
{:foo #}
=> (get-as-date q :foo)
#
=> (def r (put (DateMap. {}) :foo (java.util.Date.)))
#'user/r
=> r
{:foo "Thu May 19 22:44:37 PDT 2011"}
=> (get-as-date r :foo)
#

(Try also storing other types of value in r, even with put, and
retrieving them, even with get-as-date. Try even strings that aren't
dates. Try calling the map as a function, or using get or a keyword,
and using the optional not-found with each. Try attaching and reading
metadata, or doing pretty much anything else commonly done with
Clojure maps. I tested all of these things and they worked properly.
In particular, using put and get-as-date interconverts Dates and
string-formatted date

Re: Radically simplified Emacs and SLIME setup

2011-05-19 Thread Tassilo Horn
Phil Hagelberg  writes:

Hi Phil,

>>   $ lein upgrade        # ==> 0.6.3
>>   $ lein plugin install swank-clojure 1.4.0-SNAPSHOT
>
> There is no Leiningen version 0.6.3--I'm assuming you're running
> 1.5.2?

Ups, you are correct. ;-)

>> Reflection warning, swank/util/io.clj:15 - call to java.lang.String
>> ctor can't be resolved.
>
> It looks like there are still problems with suppressing output from
> the subprocess. I'll see if I can get that fixed soon.
>
>> I have to say that this project uses a clojure 1.3.0 snapshot.  Is that
>> supposed to work?  And if not, is there some workaround?
>
> If you upgrade to leiningen from git it will remove the *classpath*
> warning, but if you have other output like reflection warnings it's
> not going to work right now unless you can get rid of it all; sorry.
> Hopefully I'll have a fix soon.

Do I get you right that the output is the problem that prevents me to
get to the SLIME REPL, since you didn't say anything at all about that
IllegalArgumentException?

Bye,
Tassilo

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Google Refine

2011-05-19 Thread dysinger
It's a way older older version of clojure but it's in there.  I've played 
around with it.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure stack

2011-05-19 Thread michele
It's not really the Emacs tools that are a problem, but the huge
amount of web pages trying - with good intentions - to help you
installing the Emacs-Clojure stack, but usually lacking some important
detail. It feels like playing a jig-saw puzzle without being able to
look at the picture on the box. Being new to Clojure and Emacs, you
really have to be devoted and have a lot of spare time.


On May 17, 9:17 pm, László Török  wrote:
> Chas, Sean, Alan,
>
> thank you for taking the discussion back on track. I completely support
> Rich's position re protecting Clojure form becoming bloated with half-baked
> features. (half-baked = conceptually and practically mature)
>
> I'm happy to have Rich as a "benevolent dictator for life" :) ( live a happy
> and long life, Rich, a keep the Clojure ball rolling! ).
>
> However, I'm not really ready to accept the fact that you have to be an
> old-school lisper (with Emacs et. al) to be able to use it with pleasure. I
> tried Emacs on Ubuntu, and I quit after two weeks, because I was simply much
> more productive using Enclojure. Maybe it's unfair, but every time I try a
> functional language IDE, I compare it to coding in F# using Visual Studio,
> which was a very pleasant experience.
>
> I'd say, it still wasn't quite 100%, but the editor, auto-complete, the REPL
> got better with every release.
>
> I'm probably unfair, as Enclojure will probably never get the financial
> backing as F# and VS has.
>
> Maybe I'll just try using Aquamacs again, and this time I'll try harder...
>
> Bests,
>
> Laszlo
>
> 2011/5/17 Alan 
>
>
>
>
>
>
>
>
>
> > On May 17, 11:00 am, Sean Corfield  wrote:
> > > On Tue, May 17, 2011 at 5:34 AM, Timothy Washington 
> > wrote:
> > > > I'm a former java developer, whose tried scala, ruby, etc. And with
> > clojure,
> > > > I haven't been this intellectually excited since I designed my first
> > DSL :)
>
> > > My commercial background is primarily (in historical order): C, C++,
> > > Java, CFML - then later Groovy, Scala and now Clojure. Back at
> > > university, I worked with Lisp a fair bit (and Prolog) and spent three
> > > years doing research on functional language design and implementation
> > > - then OO came along (with C++) and steamrollered everything else :)
> > > I'm very pleased to see functional programming being taken seriously
> > > again these days and attracting people from mainstream / OO
> > > backgrounds!
>
> > Me! I used Java and C for years before my abortive attempt to learn
> > CL, followed by a more enthusiastic leap towards Clojure.
>
> > > As Chas and others have hinted, tooling support is fairly immature for
> > > Clojure and there's quite a split between the "old school Lispers"
> > > with Emacs / Slime / Swank / etc (not intended as a knock but it seems
> > > the folks who favor this stuff are long time Emacs and/or Lisp users?)
> > > and the "former Java devs" with Eclipse / IntelliJ / NetBeans and
> > > their plugins.
>
> > For what it's worth, a year ago I had never touched Emacs and was
> > terrified by it, partly because of the attitude of superiority Emacs
> > users tend to have. But I was learning lisp, and Emacs was reported to
> > be the best tool for lisp, so by God I learned Emacs. A year later: I
> > still use Eclipse for Java, and occasionally for its "Team" SVN
> > features, but I use Emacs for everything else. I try to hide my new-
> > found attitude of superiority :).
>
> > --
> > 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 are moderated - please be patient with
> > your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en
>
> --
> László Török
>
> Skype: laczoka2000
> Twitter: @laczoka

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Google Refine

2011-05-19 Thread Daniel Gagnon
Google just launched and interesting power tool to clean up messy data which
you might want to look at:

http://code.google.com/p/google-refine/wiki/Screencasts

Sounds pretty nifty isn't it?

What they do not mention in the screencast (or anywhere else for that
matter), is that it comes with clojure bundled in.

Try to create a "custom text facet" in it and clojure will be offered as one
of the 3 languages you can transform your data with.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: extending types

2011-05-19 Thread Lachlan
Hi Ken,

I hadn't thought of using explicit metadata for this purpose, I guess
I was thinking that the class of the object would determine what it
could do.

Just working through this, if we take your example above, what if I
wanted to override the 'put' method rather than define a new one,
since we don't have access to 'proxy-super'.  For example making a map
that enforces storage of dates in a string format - something like:

(defprotocol DMap (put [this o1 o2]) (get-as-date [this o1]))

(extend-type clojure.lang.PersistentArrayMap
  NPut
  (put [this o1 o2] (if (::datestore (meta this)) (super put o1
(format-date-to-string o2)) (super put o1 o2)))
  (get-as-date [this o1] (if (::datestore (meta this)) (parse-date
(super get o1)) (super get o1)))

and get will return the string formatted version

or another example could be forcing all keys to be keywords, even if
they are provided as a string or symbol, without having to write
(assoc {} (keyword k) v) all the time.

the other motivation would be to be able to throw exceptions on
invalid input into a map or vector, rather than debugging involving
'why the hell has that map got an xxx in it!' when after much
searching it turns out i've got some function arguments around the
wrong way :)

Cheers,


- Lachlan


On 19 May 2011 11:17, Ken Wesson  wrote:
> On Wed, May 18, 2011 at 7:19 PM, Lachlan  wrote:
>> A further example of this proxy method not working would be trying to
>> add methods to a clojure.lang.PersistentVector.  It doesn't seem to
>> have an  ??
>
> => (seq (.getConstructors (type [])))
> nil
>
> PersistentVector lacks public constructors.
>
> => (filter #(.contains (str %) "static") (.getMethods (type [])))
> (# clojure.lang.PersistentVector.create(java.lang.Object[])>
>  # clojure.lang.PersistentVector.create(java.util.List)>
>  # clojure.lang.PersistentVector.create(clojure.lang.ISeq)>
>  # clojure.lang.AFn.applyToHelper(clojure.lang.IFn,clojure.lang.ISeq)
> throws java.lang.Exception>)
>
> It has what appear to be three static factory methods instead.
> Subclassing it seems unlikely to be possible.
>
>> Similarly, list is a problem.  The proxy method works when you provide
>> a value, but PersistentList$EmptyList does not.
>>
>> It seems to work nicely with clojure.lang.PersistentArrayMap, so this
>> kind of thing works
>>
>> (.dosomething (proxy [clojure.lang.PersistentArrayMap user.A] []
>> (dosomething [] (println (:akey this)
>> -> nil
>> (.dosomething (proxy [clojure.lang.PersistentArrayMap user.A]
>> [(into-array Object [:akey :aval])] (dosomething [] (println (:akey
>> this)
>> -> :aval
>>
>> ahh corners!
>
> Is there a reason not to just extend-type the type you're interested
> in? That is, why do you specifically want the protocol to work only
> with specially-created instances of String or PersistentVector or
> PersistentArrayMap, rather than extend it to those types and simply
> not use it for other instances?
>
> If you want to be able to distinguish the special instances at
> runtime, perhaps you'd be better off creating a wrapper object
> instead; or in the case of PersistentVector and PersistentArrayMap,
> using metadata to identify the special instances. You can even enforce
> it:
>
> (defprotocol Fooable
>  (foo [this]))
>
> (extend-type clojure.lang.PersistentArrayMap
>  Fooable
>  (foo [this]
>    (if (::fooable (meta this))
>      (println "fooed " this)
>      (throw (Error. "not fooable")
>
> (defn fooable-array-map [& args]
>  (with-meta
>    (apply array-map args)
>    {::fooable true}))
>
> user=> (foo (fooable-array-map :a 1 :b 2))
> "fooed {:a 1 :b 2}"
> nil
> user=> (foo (array-map :a 1 :b 2))
> #
> user=>
>
> --
> Protege: What is this seething mass of parentheses?!
> Master: Your father's Lisp REPL. This is the language of a true
> hacker. Not as clumsy or random as C++; a language for a more
> civilized age.
>
> --
> 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 are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en



-- 
J Lachlan Kanaley

M 0413 191 194
E lachlan.kana...@gmail.com

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: A simulation of the Monty Hall Problem

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 6:43 PM, siyu798  wrote:
>> There's a difference between :a and #{:a}, though, and it will cause
>> the switch case to never win since if prize-door is :a and picked-door
>> ends up #{:a} they won't compare equal.
>
> prize-door is a set

Eh. Your implementation is a bit ... unusual. Though it lets you use
set/difference to simplify the exclusionary bits instead of remove
#{foo}. On the other hand, part of your performance problem may come
from using such a high level of abstraction.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 7:43 PM, mike.w.me...@gmail.com  wrote:
> The "download the massive IDE" path seems to presume that a newcomer
> actually needs something more than "a simple REPL" in order to get started.
> I'd claim that's wrong - at least in a world where any computer you'd run
> clojure on can multitask and display multiple windows. Yes, a system where
> the editor and REPL are tightly coupled is much more productive, but that's
> at a micro scale. Running a simple editor in one window and a REPL in a
> shell/console window in another will do for starters - it'll still be a lot
> faster than a typical edit/compile/run cycle, and should be sufficient to
> get a feel for how Clojure is a win at the macro scale.
>
> Doesn't nearly everybody include a JVM with their OS distibution these days
> - with the exception of Windows? If so, then skip installing it for everyone
> but Windows, add the JRE to the Windows binary, and note that "unusual"
> Unix/Linux. Systems may need to install either the JVM or JRE (if someone is
> running one of those, they're almost certainly used to this by now).
>
> Now add a clj script for Unix systems, a batch file for Windows (preferably
> one that can start from an icon) and similar for the Mac. For an editor,
> just bundle a properly configured copy of JEdit (until someone gets around
> to writing a light-weight IDE in clojure). Provide a writeup on "other
> editors/IDEs" containing pointers to paragraphs on how to install plugins
> for various popular IDEs and and how to configure other editors for tweaking
> clojure, along with instructions to load code into and switch to any REPL
> they support it.
>
> That should get you a distribution that works with little or no hassle for
> most newcomers, and easily gets them to the point of being able to work on
> various web problem sets using Clojure.

This sounds workable. Though, again, I thought someone here already
was making a lightweight Clojure IDE?

Also, on Windows you might want to bundle the javaw from a JDK and not
just a normal JRE, even if not the full JDK (the OpenJDK license, at
least, should permit such a distribution). Otherwise users won't (for
some silly reason) have access to the server VM, and therefore won't
have access to that VM's superior HotSpot optimizations.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 7:13 PM, pmbauer  wrote:
> Lein is one such option, but unlikely to get official recognition giving
> clojure/core's (arguably correct) decision to stick to maven.

Talk about a heavyweight, intimidating experience. :)

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread Sean Corfield
On Thu, May 19, 2011 at 12:16 AM, Thorsten Wilms  wrote:
> After initially installing a Clojure package on Ubuntu, I then learned that
> it was totally unnecessary for a project using Leiningen ...

Yeah, part of me wishes that Leiningen would get official endorsement
as "the" build tool for Clojure in the same way that sbt has become
the semi-official / partially-endorsed build tool for Scala. Having
tried to introduce quite a few people to Clojure that do not have Java
backgrounds, Leiningen has always ended up being the simplest choice
and the easiest for them to understand.

> Despite using ? and * in bash, that was not clear to me. I even briefly
> thought about the use of ? to mark predicates, but of course that makes no
> sense, here.

I was really puzzled when I first saw function names containing ? (and
other punctuation) but I've gradually gotten used to it. Even today
tho', I sometimes look at Clojure code containing things that don't
immediate say "identifier" and I have to squint and shake my head :)

> It's hard to get into the shoes of someone who doesn't know
> what you know.

Very true - and that's probably why the documentation isn't as
n00b-friendly as it could be.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread mike.w.me...@gmail.com
pmbauer  wrote:

>I'm beginning to think this has degenerated a bit into argument for 
>arguments sake.
>
>Yes, JRE. You don't need the JDK to read/eval .clj files. And in the 
>context of where this all started, namely, critiques to the current
>getting 
>started experience for new users, a 75MB JDK + 100MB IDE is exactly the
>sort 
>of heavyweight, intimidating experience that detracts from initial
>exposure. 
>Clojure isn't just competing with Groovy, Scala, and other JVM
>languages for 
>developer attention. Websites like try-clojre.org have their place, but
>aren't really in this context.

The "download the massive IDE" path seems to presume that a newcomer actually 
needs something more than "a simple REPL" in order to get started. I'd claim 
that's wrong - at least in a world where any computer you'd run clojure on can 
multitask and display multiple windows. Yes, a system where the editor and REPL 
are tightly coupled is much more productive, but that's at a micro scale. 
Running a simple editor in one window and a REPL in a shell/console window in 
another will do for starters - it'll still be a lot faster than a typical 
edit/compile/run cycle, and should be sufficient to get a feel for how Clojure 
is a win at the macro scale.

Doesn't nearly everybody include a JVM with their OS distibution these days - 
with the exception of Windows? If so, then skip installing it for everyone but 
Windows, add the JRE to the Windows binary, and note that "unusual" Unix/Linux. 
Systems may need to install either the JVM or JRE (if someone is running one of 
those, they're almost certainly used to this by now).

Now add a clj script for Unix systems, a batch file for Windows (preferably one 
that can start from an icon) and similar for the Mac. For an editor, just 
bundle a properly configured copy of JEdit (until someone gets around to 
writing a light-weight IDE in clojure). Provide a writeup on "other 
editors/IDEs" containing pointers to paragraphs on how to install plugins for 
various popular IDEs and and how to configure other editors for tweaking 
clojure, along with instructions to load code into and switch to any REPL they 
support it.

That should get you a distribution that works with little or no hassle for most 
newcomers, and easily gets them to the point of being able to work on various 
web problem sets using Clojure. 
-- 
Sent from my Android tablet with K-9 Mail. Please excuse my brevity.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure stack

2011-05-19 Thread Korny Sietsma
Just adding my +1 - as someone relatively new to clojure, leiningen is a
great way to get up and running, for a reasonably experienced developer.
 (It's a big improvement on when I first tried clojure a couple of years
ago!)
There seem to be windows instructions at
https://github.com/technomancy/leiningen/ as well

I don't know that Clojure really needs a "for dummies" install - it's
frankly not a language for newbies. If you just want people to be able to
dip their toes in the language, then http://try-clojure.org/ is a good place
to go.

But if you want to attract experienced developers, then I think pointing
them at a build tool, especially one with as good a bootstrap mechanism as
leiningen, is a great way to go.  Experienced developers (who are likely to
grok clojure) probably already use one of ant / rake / maven / sbt etc.
 Even the IDE users probably understand the need to dip into the
command-line for things like building deployable artifacts.

It would be nifty to have a Typesafe-style automatic installer available -
but not vital; and it means you start getting locked down to a particular
set of tools, which probably won't be the "right" tools for many people.
 (For example in my experience the Intellij Scala plugin is rather more
useable than the Eclipse one, I'm not sure how having the Eclipse IDE as the
"official stack" is helping the language)

- Korny

On 20 May 2011 07:50, pmbauer  wrote:

> The recommended way definitely should be one of the painless installs.
>> This works:
>>
>> * Download NetBeans, configuring on the NB homepage for J2SE, and run
>> installer
>>
> So does this:
>>
>> * Download Eclipse J2SE
>>
> Sure, but that's still a lot of work just to get a simple repl.
>
> The easiest way (by far, and it doesn't work on Windows):
> $ wget https://github.com/technomancy/leiningen/raw/stable/bin/lein; lein
> repl
>
> clojure.org and the standard distro could use a little tlc.
>
> --
> 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 are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>



-- 
Kornelis Sietsma  korny at my surname dot com http://korny.info
"Every jumbled pile of person has a thinking part
that wonders what the part that isn't thinking
isn't thinking of"

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Radically simplified Emacs and SLIME setup

2011-05-19 Thread Phil Hagelberg
On May 18, 11:39 pm, Tassilo Horn  wrote:
> I tried it by first deinstalling any clojure/swank/SLIME packages I
> had.  Then I installed clojure-mode 1.9.0 from the marmalade-repo.
>
> In a terminal, I did
>
>   $ lein upgrade        # ==> 0.6.3
>   $ lein plugin install swank-clojure 1.4.0-SNAPSHOT

There is no Leiningen version 0.6.3--I'm assuming you're running
1.5.2?

> Then I opened some clojure file in an existing project and did
>
>   M-x clojure-jack-in RET
>
> I got a new popup *swank* buffer, but in there, I get an exception.
> Warning: *classpath* not declared dynamic and thus is not dynamically 
> rebindable, but its name suggests otherwise. Please either indicate ^:dynamic 
> *classpath* or change the name.
> Reflection warning, swank/util/io.clj:15 - call to java.lang.String ctor 
> can't be resolved.

It looks like there are still problems with suppressing output from
the subprocess. I'll see if I can get that fixed soon.

> I have to say that this project uses a clojure 1.3.0 snapshot.  Is that
> supposed to work?  And if not, is there some workaround?

If you upgrade to leiningen from git it will remove the *classpath*
warning, but if you have other output like reflection warnings it's
not going to work right now unless you can get rid of it all; sorry.
Hopefully I'll have a fix soon.

-Phil

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread pmbauer
I'm beginning to think this has degenerated a bit into argument for 
arguments sake.

Yes, JRE.  You don't need the JDK to read/eval .clj files. And in the 
context of where this all started, namely, critiques to the current getting 
started experience for new users, a 75MB JDK + 100MB IDE is exactly the sort 
of heavyweight, intimidating experience that detracts from initial exposure. 
Clojure isn't just competing with Groovy, Scala, and other JVM languages for 
developer attention. Websites like try-clojre.org have their place, but 
aren't really in this context.

Official support for a starter kit that automatically downloads or packages 
clojure, jline, etc would go a long way to lowering barrier-to-entry.
Lein is one such option, but unlikely to get official recognition giving 
clojure/core's (arguably correct) decision to stick to maven.

Groovy is really exemplary in this regard: installer on windows, .deb/apt 
packaging on linux (clojure has one, but it's 1.0).

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: A simulation of the Monty Hall Problem

2011-05-19 Thread siyu798


On Thursday, May 19, 2011 6:36:34 PM UTC-4, Ken Wesson wrote:
>
> On Thu, May 19, 2011 at 6:16 PM, siyu798  wrote:
> > On Thursday, May 19, 2011 4:38:17 PM UTC-4, Ken Wesson wrote:
> >> On Thu, May 19, 2011 at 12:52 PM, siyu798  wrote:
> >> >(set/difference doors opened-door picked-door)
> >>
> >> Shouldn't that be wrapped in (first ...) or something?
> >
> >  do you mean wrap the returned picked-door set in (first ...)?  Since 
> this
> > is a three doors scenario so there should always be one door left to 
> switch
> > to, thus no need to use first.
>
> There's a difference between :a and #{:a}, though, and it will cause
> the switch case to never win since if prize-door is :a and picked-door
> ends up #{:a} they won't compare equal.
>
prize-door is a set 

> > For some reasons I always have the impression that it's not idiomatic to 
> use
> > chained let form like the play fn here, is there a more idiomatic way to
> > write this code?
>
> AFAIK there is nothing whatsoever wrong with using chained let. It's
> "procedural-ish" but it is still functional (immutable locals and all
> that), often clearer than a densely-nested expression (not to mention
> when some of the bound values get used more than once), and perhaps
> most importantly, it works just fine in practice.
>
Thanks, 

> -- 
> Protege: What is this seething mass of parentheses?!
> Master: Your father's Lisp REPL. This is the language of a true
> hacker. Not as clumsy or random as C++; a language for a more
> civilized age.
>
>

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure stack

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 6:17 PM, pmbauer  wrote:
> Mmm, not quite.
> Doesn't clojure run just fine with the 15MB JVM?

Do you mean the JRE? And if so: for development, rather than just deployment?

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 6:36 PM, David Nolen  wrote:
> On Thu, May 19, 2011 at 6:00 PM, László Török  wrote:
>>
>> Scala gets parallel collections (i.e. leverage multi-core CPUs)
>>
>>
>> http://www.infoq.com/news/2011/05/scala-29;jsessionid=BCF6B009442F5F0D9C18A06D3790C3DA
>>
>> just to give this thread a new spark...:)
>
> Clojure used to have parallel collections as well (based on Fork/Join) - but
> this is a JDK 7 requirement that I don't think Clojure is willing to take
> on. It would be great to see somebody build parallel collection support for
> Clojure that doesn't require JDK 7.

I take it you mean something distinct from pmap and preduce by
"parallel collections" here.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread David Nolen
On Thu, May 19, 2011 at 6:00 PM, László Török  wrote:

> Scala gets parallel collections (i.e. leverage multi-core CPUs)
>
>
> http://www.infoq.com/news/2011/05/scala-29;jsessionid=BCF6B009442F5F0D9C18A06D3790C3DA
>
> just to give this thread a new spark...:)
>

Clojure used to have parallel collections as well (based on Fork/Join) - but
this is a JDK 7 requirement that I don't think Clojure is willing to take
on. It would be great to see somebody build parallel collection support for
Clojure that doesn't require JDK 7.

David

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: A simulation of the Monty Hall Problem

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 6:16 PM, siyu798  wrote:
> On Thursday, May 19, 2011 4:38:17 PM UTC-4, Ken Wesson wrote:
>> On Thu, May 19, 2011 at 12:52 PM, siyu798  wrote:
>> >                        (set/difference doors opened-door picked-door)
>>
>> Shouldn't that be wrapped in (first ...) or something?
>
>  do you mean wrap the returned picked-door set in (first ...)?  Since this
> is a three doors scenario so there should always be one door left to switch
> to, thus no need to use first.

There's a difference between :a and #{:a}, though, and it will cause
the switch case to never win since if prize-door is :a and picked-door
ends up #{:a} they won't compare equal.

> For some reasons I always have the impression that it's not idiomatic to use
> chained let form like the play fn here, is there a more idiomatic way to
> write this code?

AFAIK there is nothing whatsoever wrong with using chained let. It's
"procedural-ish" but it is still functional (immutable locals and all
that), often clearer than a densely-nested expression (not to mention
when some of the bound values get used more than once), and perhaps
most importantly, it works just fine in practice.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread pmbauer
Mmm, not quite.
Doesn't clojure run just fine with the 15MB JVM?

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: A simulation of the Monty Hall Problem

2011-05-19 Thread siyu798


On Thursday, May 19, 2011 4:38:17 PM UTC-4, Ken Wesson wrote:
>
> On Thu, May 19, 2011 at 12:52 PM, siyu798  wrote:
> > Hi, I started learning clojure for a few months and this is what I have 
> for
> > the problem, and I find it running very slow if exceeding 100k trials, 
> maybe
> > it's because of using set?  Any feedbacks will be appreciated. thx
> > (require '[clojure.set :as set])
> > (def doors #{:a :b :c})
> > (defn rand-nth-set [s]
> >  (conj #{} (rand-nth (seq s
>
> #{(rand-nth (seq s))} should work as well.
>

Actually that's what I had but changed to the current form because of 
personal preference.

> > (defn play
> >   ([] (play nil))
> >   ([switch?]
> >(let [prize-door  (rand-nth-set doors)
> >  picked-door (rand-nth-set doors)
> >  empty-doors (set/difference doors prize-door)
> >  opened-door (rand-nth-set (set/difference empty-doors 
> picked-door))
> >  picked-door (if switch?
> >(set/difference doors opened-door picked-door)
>
> Shouldn't that be wrapped in (first ...) or something?
>
 do you mean wrap the returned picked-door set in (first ...)?  Since this 
is a three doors scenario so there should always be one door left to switch 
to, thus no need to use first.  

For some reasons I always have the impression that it's not idiomatic to use 
chained let form like the play fn here, is there a more idiomatic way to 
write this code?

> >picked-door)]
> >  (= picked-door prize-door
> > (count (remove #(false? %) (repeatedly 1 #(play true
> > (count (remove #(false? %) (repeatedly 1 #(play false
>
> As for the speed, I'm not sure what the problem is.
>
> -- 
> Protege: What is this seething mass of parentheses?!
> Master: Your father's Lisp REPL. This is the language of a true
> hacker. Not as clumsy or random as C++; a language for a more
> civilized age.
>
>

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure stack

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 6:02 PM, Ken Wesson  wrote:
> On Thu, May 19, 2011 at 5:58 PM, pmbauer  wrote:
>> "So now you go download this 100MB IDE" is a little heavy. No?

> Don't forget the JDK alone weighs in at three-quarters of that:
>
> jdk-6u25-ea-bin-b03-windows-i586-27_feb_2011.exe, 76.69 MB
>
> (found on http://download.java.net/jdk6/6u25/promoted/latest/binaries/)

Oh, and that's the SMALLEST one on there, not counting the two tiny
Solaris 64-bit ones, which I can only presume can be that small
because a load of dependencies ship with 64-bit Solaris but have to be
bundled with the JDKs for other operating system.

Of course, "buy this $50,000 Solaris mainframe" is even worse than
"download this 100MB IDE" for heaviness. :)

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 5:58 PM, pmbauer  wrote:
>> If ALL you want is a SIMPLE repl you can just go to the tryclojure site.
>> :)
>
> Not quite.
> As far as official disto's go, the current state is a little raw for getting
> started
> And having the official getting started instructions be (as you suggested)
> "So now you go download this 100MB IDE" is a little heavy. No?
> There's room for something in-between.

Wasn't someone posting here not long ago about a lightweight Clojure
editor/IDE they were working on? What ever happened to that?

At the same time, there's only so much you can shrink the install.
Don't forget the JDK alone weighs in at three-quarters of that:

jdk-6u25-ea-bin-b03-windows-i586-27_feb_2011.exe, 76.69 MB

(found on http://download.java.net/jdk6/6u25/promoted/latest/binaries/)

So, it's tryclojure or it's an at-least-75-meg download. One of the
prices we pay for being a JVM language, I guess.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread László Török
Scala gets parallel collections (i.e. leverage multi-core CPUs)

http://www.infoq.com/news/2011/05/scala-29;jsessionid=BCF6B009442F5F0D9C18A06D3790C3DA

just to give this thread a new spark...:)

2011/5/19 Ken Wesson 

> On Thu, May 19, 2011 at 5:50 PM, pmbauer 
> wrote:
> >> The recommended way definitely should be one of the painless installs.
> >> This works:
> >>
> >> * Download NetBeans, configuring on the NB homepage for J2SE, and run
> >> installer
> >>
> >> So does this:
> >>
> >> * Download Eclipse J2SE
> >
> > Sure, but that's still a lot of work just to get a simple repl.
>
> If ALL you want is a SIMPLE repl you can just go to the tryclojure site. :)
>
> --
> Protege: What is this seething mass of parentheses?!
> Master: Your father's Lisp REPL. This is the language of a true
> hacker. Not as clumsy or random as C++; a language for a more
> civilized age.
>
> --
> 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 are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>



-- 
László Török

Skype: laczoka2000
Twitter: @laczoka

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure stack

2011-05-19 Thread pmbauer

>
> If ALL you want is a SIMPLE repl you can just go to the tryclojure site. :)
>
Not quite.
As far as official disto's go, the current state is a little raw for getting 
started
And having the official getting started instructions be (as you suggested) 
"So now you go download this 100MB IDE" is a little heavy. No?

There's room for something in-between.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Comparison of CCW and Enclojure

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 5:48 PM, Ken Wesson  wrote:
> Found a new bug and it's a head-scratcher.

And right on its heels, another one. CCW's REPL seems to have the
desirable property that ctrl-dn at the most recent history item gets
you a blank prompt. Or rather, it did. Now it gives me
*clojure-version* instead, even if the most recently evaluated form
was something different. That happens to be the first form I evaluated
after restarting the REPL, and I used autocomplete (in fact, I did it
to test that autocomplete was working again). Perhaps if you start a
REPL and immediately use autocomplete, it gets "stuck" in place of a
blank line as the line to display if you go "off the bottom" of the
history?

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 5:50 PM, pmbauer  wrote:
>> The recommended way definitely should be one of the painless installs.
>> This works:
>>
>> * Download NetBeans, configuring on the NB homepage for J2SE, and run
>> installer
>>
>> So does this:
>>
>> * Download Eclipse J2SE
>
> Sure, but that's still a lot of work just to get a simple repl.

If ALL you want is a SIMPLE repl you can just go to the tryclojure site. :)

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure example code snippets

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 5:47 PM, Andreas Kostler
 wrote:
> Hi Armando,
> I'm working on a Clojurej library for sentiment analysis which doesn't 
> contain everything you'd want for nlp but quite a nice subset of input 
> modules (plain text corpora, rss feeds, html, etc...),
> tokenising/normalising filters (noise removal, porter stemmer, etc), 
> distance/similarity metrics (euclidean, cosine, peasrsons, Jaccard/Tanimoto), 
> b-o-w vector representation, clustering (hierarchical, k-means), 
> classification (NN, Bayes, knn), and some other little tidbits to tie up 
> loose ends. There will be a first release in about 2-3 weeks time. If you're 
> planning on doing work in that direction, maybe we could join forces :)
> Kind Regards
> Andreas

Whoa, what the heck are you doing, trying to build Skynet? :)

Then again, Lisp HAS traditionally been the preferred language of AI hackers...

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread pmbauer

>
> The recommended way definitely should be one of the painless installs.
> This works:
>
> * Download NetBeans, configuring on the NB homepage for J2SE, and run 
> installer 
>
So does this:
>
> * Download Eclipse J2SE
>
Sure, but that's still a lot of work just to get a simple repl.

The easiest way (by far, and it doesn't work on Windows):
$ wget https://github.com/technomancy/leiningen/raw/stable/bin/lein; lein 
repl

clojure.org and the standard distro could use a little tlc.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Comparison of CCW and Enclojure

2011-05-19 Thread Ken Wesson
Found a new bug and it's a head-scratcher. Autocomplete quit working
sometime overnight. Now I get a SocketException message "Software
caused connection abort" if I hit control-space at the REPL. REPL
process is connected OK -- I can evaluate forms at it -- so it's not
the REPL-to-Eclipse socket connection that's failed. Firewall and
Wireshark type tools show nothing unusual on the internet uplink, so
it looks to be some other use of the loopback interface that's
b0rking.

Weird.

In a related development, the Namespace Browser is blank and has been
for a while. I had a long-running calculation last night evaluating at
the REPL during which it blanked and came back. I think it may have
blanked again and then failed to come back. This was while I was
investigating the head-holding issue with apply and arguments
containing embedded lazy seqs. I think it might be related to this odd
exception trace I got for one of those, where the OOME apparently got
thrown into a different thread in the JVM:

java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError:
Java heap space
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:232)
at java.util.concurrent.FutureTask.get(FutureTask.java:91)
at clojure.tools.nrepl$handle_response.invoke(nrepl.clj:263)
at clojure.tools.nrepl$message_dispatch$fn__179.invoke(nrepl.clj:303)
at clojure.lang.AFn.call(AFn.java:18)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.OutOfMemoryError: Java heap space

Restarting the REPL process fixed both problems (the Namespace Browser
remained blank until a mousemove event was generated within its
bounding box, then promptly filled in).

I'm not sure if the OOME caused it. If not, then it looks like the
problem is something that can get into a bogus state over on the REPL
process side. Does CCW open two separate connections to the REPL
process, one for evaluations and one for introspecting into the
namespaces and other state of the session?

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure example code snippets

2011-05-19 Thread Andreas Kostler
Hi Armando,
I'm working on a Clojurej library for sentiment analysis which doesn't contain 
everything you'd want for nlp but quite a nice subset of input modules (plain 
text corpora, rss feeds, html, etc...),
tokenising/normalising filters (noise removal, porter stemmer, etc), 
distance/similarity metrics (euclidean, cosine, peasrsons, Jaccard/Tanimoto), 
b-o-w vector representation, clustering (hierarchical, k-means), classification 
(NN, Bayes, knn), and some other little tidbits to tie up loose ends. There 
will be a first release in about 2-3 weeks time. If you're planning on doing 
work in that direction, maybe we could join forces :)
Kind Regards
Andreas
 
On 20/05/2011, at 5:12 AM, Armando Blancas wrote:

> Just in case I'll mention that Meikel's use of (with-open) will
> automatically close the reader.
> 
> On May 19, 11:40 am, dokondr  wrote:
>> On May 19, 6:52 pm, Meikel Brandmeyer  wrote:
>> 
>>> Hi,
>> 
>>> something like the following should work.
>> 
>>> (with-open [rdr (java.io.FileReader. "file.txt")]
>>>   (doseq [line (line-seq rdr)
>>>   word (.split line "\\s")]
>>> (when (.endsWith word "ing")
>>>   (println word
>> 
>>> Sincerely
>>> Meikel
>> 
>> Thanks everybody! The short one from Meikel (above) looks nice to
>> me :)
>> 
>> And the one from ClojureDocs too:
>> 
>> (defn read-lines
>>   "Like clojure.core/line-seq but opens f with reader.  Automatically
>>   closes the reader AFTER YOU CONSUME THE ENTIRE SEQUENCE."
>>   [f]
>>   (let [read-line (fn this [^BufferedReader rdr]
>> (lazy-seq
>>  (if-let [line (.readLine rdr)]
>>(cons line (this rdr))
>>(.close rdr]
>> (read-line (reader f
> 
> -- 
> 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 are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

--
"Test-driven Dentistry (TDD!) - Not everything should be test driven"
- Michael Fogus
-- 
**
Andreas Koestler, Software Engineer
Leica Geosystems Pty Ltd
270 Gladstone Road, Dutton Park QLD 4102
Main: +61 7 3891 9772 Direct: +61 7 3117 8808
Fax: +61 7 3891 9336
Email: andreas.koest...@leica-geosystems.com

www.leica-geosystems.com*

when it has to be right, Leica Geosystems

Please  consider the environment before printing this email.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 5:35 PM, pmbauer  wrote:
> The official way to get started has way too many sharp edges
> (Download JDK, install, set JAVA_HOME, add JAVA_HOME/bin to path, download
> clojure.zip, extract, sacrifice chicken, run java -cp clojure.jar
> clojure.main) ... at which point you get a kinda crappy REPL. Oops.
>
> Compare to (on linux):
> sudo apt-get install groovy; groovysh # even installs openjdk if needed

The recommended way definitely should be one of the painless installs.
This works:

* Download NetBeans, configuring on the NB homepage for J2SE, and run installer.
* Run it and browse for plugins; find and install Enclojure.
* Restart NB and voila!

So does this:

* Download Eclipse J2SE.
* Run it and browse for plugins (Eclipse Marketplace); find and install CCW.
* Restart Eclipse, reset perspective, and voila!

(Warning, that second to last item is non-obvious, and the symptoms of
not doing it are also not obvious to diagnose.)

Both result in much nicer REPLs; but also the baggage of having to
create a project and start the REPL in that context. But then, they'll
also help you manage your .clj files.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread pmbauer
The official way to get started has way too many sharp edges
(Download JDK, install, set JAVA_HOME, add JAVA_HOME/bin to path, download 
clojure.zip, extract, sacrifice chicken, run java -cp clojure.jar clojure.main) 
... at which point you get a kinda crappy REPL. Oops.

Compare to (on linux):
sudo apt-get install groovy; groovysh # even installs openjdk if needed

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Help: how to construct lazy sequences

2011-05-19 Thread timc
That was very helpful - thanks Meikel and Jonathon.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Race condition in update-proxy?

2011-05-19 Thread Ken Wesson
Update-proxy is not thread-safe. I took a look at the guts of it and:

(. cv (visitField (+ (. Opcodes ACC_PRIVATE) (. Opcodes ACC_VOLATILE))
  fmap (. imap-type (getDescriptor)) nil nil))

i.e. there's a private volatile mutable field rather than atom holding
the function map. So if

(update-proxy foo {"meth1" fn1})

and

(update-proxy foo {"meth2" fn2})

were to execute at the same time, it's possible for only one of meth1
and meth2 to end up updated, versus if it used an atom and (swap! fmap
merge update-map).

Also, I'm no bytecode expert, but this:

  (. gen (getField ctype fmap imap-type))
  (.checkCast gen (totype clojure.lang.IPersistentCollection))
  (. gen (loadArgs))
  (. gen (invokeInterface (totype clojure.lang.IPersistentCollection)
  (. Method (getMethod
"clojure.lang.IPersistentCollection cons(Object)"
  (. gen (checkCast imap-type))
  (. gen (putField ctype fmap imap-type))

looks a lot like it's generating

__clojureFnMap =
(IPersistentMap)((IPersistentCollection)__clojureFnMap).cons(updateMap);

to me, when it surely ought to be merging the maps instead, unless
there's something tricky going on here. Which I assume there is, since
if it were actually consing one of the maps onto the other and trying
to cast the result to IPersistentMap update-proxy would blow up with a
CCE at runtime, and instead it works perfectly (modulo the apparent
race condition).

(And what's with the mixed (. foo (meth & args)) and (.meth foo &
args) styles here? Bootstrap's obviously progressed sufficiently at
that point for the latter, preferred form to work...)

There's also a documented thread-unsafety with proxy-super. At a
guess, it looks like proxy-super toggles the proxy into a state where
the proxy method calls super instead of calling its proxy function,
calls it, and toggles it back. I can easily envision a thread-safer
implementation making name-mangled copies of every inherited concrete
method for calling super; for the method meth1, generate the
equivalent of this Java:

public Type1 meth1 (Type2 arg1, Type3 arg2 ...) {
__clojureFnBindings.get("meth1").invoke(arg1, arg2 ...);
}

public Type1 meth1_super_caller (Type2 arg1, Type3 arg2 ...) {
super.meth1(arg1, arg2 ...);
}

only with the first method's body wrapped in something analogous to Clojure:

(binding [*proxy-super* meth1_super_caller] ...)

and have proxy-super call (apply *proxy-super* args).

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread Phil Hagelberg
On May 18, 5:06 pm, Sean Corfield  wrote:
> I've seen a number of people struggle with the instructions here:
>
> http://clojure.org/getting_started
>
> Let's walk thru the process from a complete n00b's p.o.v. (since this
> is the Getting Started page)...
>
> First thing discussed, the github repo. If I go there (not wanting the
> source but being hopeful about a download), and click Downloads, and
> pick either the .tar.gz or the .zip options, I get an archive of
> source code. Fail.
>
> Let's try other downloads offered (since I don't want "alpha"
> anything)... clojure-1.2.0.zip looks promising... OK, it is a full
> source download but it *does* include a .jar file and java -jar
> clojure.jar does actually start a REPL. Not a great experience but it
> sort of works.

Well, for one thing 1.2.0 is not the latest stable version; it should
point to 1.2.1. The zip of 1.2.0 contains a very broken "clj" shell
script. Not shipping a launcher with Clojure is a shame, but it's
better than including a broken one.

Then we have half the page talking about debugging and profiling, but
in all the time I've used Clojure I haven't ever felt the need to do
either of these things. Definitely not "getting started" material.

> Back to the Getting Started page to see what next CLR? Nah.
> Development collaboration on JIRA? Nah. Feedback and discussion on the
> Clojure Google Group? Not clear that's going to help a n00b (but it
> would!).
>
> Link to Clojure Programming wiki. OK. (who maintains that and how
> up-to-date is it?)
>
> Explanation of what's in the download... Far more than a n00b needs to
> know (bytecode library? really?)...

I can't help but think these are just symptoms of having a page for
which only a handful of people have edit rights. If this were on the
wiki we could have cleaned it up by now. Perhaps clojure.org shouldn't
have its own "Getting Started" page at all?

The thing I've seen causing the most confusion (not specific to
clojure.org or the wiki but just "getting started" in general) is
simply the notion that you don't really need to "install Clojure" to
get running with it, which is very different from every other language
I've used. People start looking in apt-get or macports and may find
something (usually way out of date), but the vast majority of seasoned
users don't go this route, opting instead for Clojure build tools and
editor environment integration. I'd add this to the wiki this myself,
but naturally I'm afraid my version would be rather biased.

-Phil

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: A simulation of the Monty Hall Problem

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 12:52 PM, siyu798  wrote:
> Hi, I started learning clojure for a few months and this is what I have for
> the problem, and I find it running very slow if exceeding 100k trials, maybe
> it's because of using set?  Any feedbacks will be appreciated. thx
> (require '[clojure.set :as set])
> (def doors #{:a :b :c})
> (defn rand-nth-set [s]
>  (conj #{} (rand-nth (seq s

#{(rand-nth (seq s))} should work as well.

> (defn play
>   ([] (play nil))
>   ([switch?]
>    (let [prize-door  (rand-nth-set doors)
>          picked-door (rand-nth-set doors)
>          empty-doors (set/difference doors prize-door)
>          opened-door (rand-nth-set (set/difference empty-doors picked-door))
>          picked-door (if switch?
>                        (set/difference doors opened-door picked-door)

Shouldn't that be wrapped in (first ...) or something?

>                        picked-door)]
>      (= picked-door prize-door
> (count (remove #(false? %) (repeatedly 1 #(play true
> (count (remove #(false? %) (repeatedly 1 #(play false

As for the speed, I'm not sure what the problem is.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure example code snippets

2011-05-19 Thread Armando Blancas
Just in case I'll mention that Meikel's use of (with-open) will
automatically close the reader.

On May 19, 11:40 am, dokondr  wrote:
> On May 19, 6:52 pm, Meikel Brandmeyer  wrote:
>
> > Hi,
>
> > something like the following should work.
>
> > (with-open [rdr (java.io.FileReader. "file.txt")]
> >   (doseq [line (line-seq rdr)
> >           word (.split line "\\s")]
> >     (when (.endsWith word "ing")
> >       (println word
>
> > Sincerely
> > Meikel
>
> Thanks everybody! The short one from Meikel (above) looks nice to
> me :)
>
> And the one from ClojureDocs too:
>
> (defn read-lines
>   "Like clojure.core/line-seq but opens f with reader.  Automatically
>   closes the reader AFTER YOU CONSUME THE ENTIRE SEQUENCE."
>   [f]
>   (let [read-line (fn this [^BufferedReader rdr]
>                     (lazy-seq
>                      (if-let [line (.readLine rdr)]
>                        (cons line (this rdr))
>                        (.close rdr]
>     (read-line (reader f

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure example code snippets

2011-05-19 Thread dokondr
On May 19, 6:52 pm, Meikel Brandmeyer  wrote:
> Hi,
>
> something like the following should work.
>
> (with-open [rdr (java.io.FileReader. "file.txt")]
>   (doseq [line (line-seq rdr)
>           word (.split line "\\s")]
>     (when (.endsWith word "ing")
>       (println word
>
> Sincerely
> Meikel


Thanks everybody! The short one from Meikel (above) looks nice to
me :)

And the one from ClojureDocs too:

(defn read-lines
  "Like clojure.core/line-seq but opens f with reader.  Automatically
  closes the reader AFTER YOU CONSUME THE ENTIRE SEQUENCE."
  [f]
  (let [read-line (fn this [^BufferedReader rdr]
(lazy-seq
 (if-let [line (.readLine rdr)]
   (cons line (this rdr))
   (.close rdr]
(read-line (reader f

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Radically simplified Emacs and SLIME setup

2011-05-19 Thread Paul Mooser
I had a similar issue with an existing project - it went away when I
created a new project and did "lein deps".

On May 18, 11:39 pm, Tassilo Horn  wrote:
> Exception in thread "main" java.lang.IllegalArgumentException: No value 
> supplied for key: 55298
>
> I have to say that this project uses a clojure 1.3.0 snapshot.  Is that
> supposed to work?  And if not, is there some workaround?

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: A simulation of the Monty Hall Problem

2011-05-19 Thread siyu798
Hi, I started learning clojure for a few months and this is what I have for 
the problem, and I find it running very slow if exceeding 100k trials, maybe 
it's because of using set?  Any feedbacks will be appreciated. thx

(require '[clojure.set :as set])
(def doors #{:a :b :c})
(defn rand-nth-set [s]
 (conj #{} (rand-nth (seq s

(defn play
  ([] (play nil))
  ([switch?]
   (let [prize-door  (rand-nth-set doors)
 picked-door (rand-nth-set doors)
 empty-doors (set/difference doors prize-door)
 opened-door (rand-nth-set (set/difference empty-doors picked-door))
 picked-door (if switch?
   (set/difference doors opened-door picked-door)
   picked-door)]
 (= picked-door prize-door

(count (remove #(false? %) (repeatedly 1 #(play true
(count (remove #(false? %) (repeatedly 1 #(play false


-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Aw: Clojure example code snippets

2011-05-19 Thread Benny Tsai
Oops.  Just noticed that the original was not quoted in either of my 
previous emails, which makes things really confusing.  My first reply (the 
one using read-lines) was an extension of odyssomay/Jonathan's code, and the 
second (with reader) was an extension of Meikel's code.  Sorry guys.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Aw: Clojure example code snippets

2011-05-19 Thread Benny Tsai
I think line-seq needs a java.io.BufferedReader instead of a 
java.io.FileReader.  clojure.java.io has a reader function that constructs a 
java.io.BufferedReader from a filename, so this worked for me:

(ns example
  (:use [clojure.java.io :only (reader)]))

(with-open [rdr (reader "file.txt")]
  (doseq [line (line-seq rdr)
  word (.split line "\\s")]
(when (.endsWith word "ing")
  (println word

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure example code snippets

2011-05-19 Thread Benny Tsai
I think there can be multiple words on each line, so they have to be split 
into words first.  Maybe something like:

(ns example
  (:use [clojure.contrib.duck-streams :only (read-lines)]))

(let [lines (read-lines "file.txt")
  words (mapcat #(.split % "\\s") lines)
  ing-words (filter (partial re-matches #".*ing") words)]
  (doseq [ing-word ing-words]
(println ing-word)))

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: San Francisco Clojure Users

2011-05-19 Thread David Jagoe
On 18 May 2011 18:54, Emeka  wrote:
> David,
> How is Clojure doing in Africa?

There really aren't that many people using it among the people that I
have spoken to. I've worked in the UK, Europe and the US and in
comparison South Africa is a little bit behind and quite conservative
when it comes to technology choices.


Cheers,
David

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clojure.contrib.sql => clojure.java.jdbc - looking for feedback!

2011-05-19 Thread Jim
On Apr 23, 9:38 am, Shantanu Kumar  wrote:

 > > 5. Provide a mode to prevent write operations
>
> > Interesting idea but isn't that better handled by grants on the user
> > accessing the database?
>
> The intention here is to proactively prevent errors from a development
> standpoint. And then, some databases do not support permissions --
> however, the notion of read-only vs writes is common in database
> development and can be useful to have.

+1 for this feature - it would also be very handy to have when running
against replicated databases. e.g. the MySQL replication driver
directs write queries to the master and read-only queries across the
slaves based on the readOnly property of the connection.



Best regards,
jim

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure example code snippets

2011-05-19 Thread Jonathan Fischer Friberg
There is clojure.contrib.duck-streams/read-lines
http://clojuredocs.org/clojure_contrib/clojure.contrib.duck-streams/read-lines

Then it's a matter of

(filter (partial re-matches #".*ing") (read-lines "/path/to/file"))

Jonathan

On Thu, May 19, 2011 at 4:52 PM, Meikel Brandmeyer  wrote:

> Hi,
>
> something like the following should work.
>
> (with-open [rdr (java.io.FileReader. "file.txt")]
>   (doseq [line (line-seq rdr)
>   word (.split line "\\s")]
> (when (.endsWith word "ing")
>   (println word
>
> Sincerely
> Meikel
>
>
>  --
> 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 are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Aw: Clojure example code snippets

2011-05-19 Thread Meikel Brandmeyer
Hi,

something like the following should work.

(with-open [rdr (java.io.FileReader. "file.txt")]
  (doseq [line (line-seq rdr)
  word (.split line "\\s")]
(when (.endsWith word "ing")
  (println word

Sincerely
Meikel

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Clojure example code snippets

2011-05-19 Thread dokondr
Hi!
I am thinking about using Clojure for distributed NLP.
Being an absolute newbie in Clojure I look for nice expressive code
snippets.

For example, I need an easy way to read text files such as in the
following Python code:
>>> for line in open("file.txt"):
... for word in line.split():
... if word.endswith('ing'):
... print word

What would be an equivalent of this code in Clojure?

Thanks,
Dmitri

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: What role does ? operator play?

2011-05-19 Thread octopusgrabbus
Many Thanks. I'm interested in learning Clojure and not everything is
obvious in books.

On May 19, 9:20 am, Meikel Brandmeyer  wrote:
> Hi,
>
> ? is not an operator, but part of the name "pos?". pos? is a function, which
> returns true if a number is positive, false otherwise.
>
> Function names ending in "?" by convention indicate that they return a
> boolean value (true or false). They are called "predicates".
>
> Sincerely
> Meikel
>
> PS: In fact there are no "operators" in Clojure...

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Aw: What role does ? operator play?

2011-05-19 Thread Meikel Brandmeyer
Hi,

? is not an operator, but part of the name "pos?". pos? is a function, which 
returns true if a number is positive, false otherwise.

Function names ending in "?" by convention indicate that they return a 
boolean value (true or false). They are called "predicates".

Sincerely
Meikel

PS: In fact there are no "operators" in Clojure...

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: What role does ? operator play?

2011-05-19 Thread Timothy Baldridge
> What role does the ? operator play. It looks like it is creating a
> variable name.
> Thanks.
>


In clojure (and other languages like Ruby) the ? is not an operator, it's
actually part of the function name. Normally ? means that the function
returns a boolean. Think of it as asking a question, so empty? would return
true if the collection is empty.

On the other hand you'll also see ! which means the function modifies the
one of the arguments.

Example (with fake functions):

(empty? [])
true

(empty! [2 3])
[]

These are just some ways of letting the user know how the function should be
used.


Timothy Baldridge

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: What role does ? operator play?

2011-05-19 Thread Alex Robbins
? isn't an operator, it is part of a function's name.

user=> (doc pos?)
-
clojure.core/pos?
([x])
  Returns true if num is greater than zero, else false
nil
user=>

Hope that helps!
Alex

On Thu, May 19, 2011 at 8:09 AM, octopusgrabbus
 wrote:
> Given the following function
>
>
> (defn proint-down-from [x]
>    (when (pos? x)
>        (println x)
>        (recur (dec x
>
> What role does the ? operator play. It looks like it is creating a
> variable name.
> 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 are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: What role does ? operator play?

2011-05-19 Thread Ambrose Bonnaire-Sergeant
Hi,

The ? is merely a convention used to name predicate functions
(ie. functions that return true or false).

It is not enforced, but clojure.core follows it. It's a good idea to follow
it.
I think ruby has a similar convention.

Thanks,
Ambrose

On Thu, May 19, 2011 at 9:09 PM, octopusgrabbus wrote:

> Given the following function
>
>
> (defn proint-down-from [x]
>(when (pos? x)
>(println x)
>(recur (dec x
>
> What role does the ? operator play. It looks like it is creating a
> variable name.
> 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 are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

What role does ? operator play?

2011-05-19 Thread octopusgrabbus
Given the following function


(defn proint-down-from [x]
(when (pos? x)
(println x)
(recur (dec x

What role does the ? operator play. It looks like it is creating a
variable name.
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread Nick Zbinden
I think there are a few things most people agree about:

- The people in the comunity are genaraly very nice and help noobs
(stackoverflow, irc. mailinglist ...)
- Clojure.org has very cool content.
- Clojure.org is not a good place for noob

So i propose some things that I think would make a better clojure
expirance.

- A beginner friendly tutorial on the clojure getting started page.
   -  take the debugging proviling away form there and put them into
there own places
- How to get clojure running? There should be an example of how to
download, compile and start clojure AND there should be references to
the other ways to get clojure to run lein, cake, cljr
- On clojure.org should have more links to recources, for example all
books about clojure (like in scalahttp://www.scala-lang.org/node/959),
there should be EASY to find links to clojuredocs, gettingclojure ...,
the Videos interduced clojure many people the should be put on
clojure.org.
- The news don't get updated enough that makes it look like nothing
happens.

A lot of information is in the web (blog ...) we just have to collect
it and present it on clojure.org


-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Help: how to construct lazy sequences

2011-05-19 Thread Jonathan Fischer Friberg
See the source of clojure.contrib.duck-streams/read-lines
http://clojuredocs.org/clojure_contrib/clojure.contrib.duck-streams/read-lines

For the second question: Use read-lines directly.

If you want a lazy-seq that doesn't close the stream when it's empty,

; untested
(defn take-bytes [rdr]
(lazy-seq (cons (.take rdr) (take-bytes rdr

which will produce an "infinite" sequence.

Jonathan

On Thu, May 19, 2011 at 11:50 AM, timc  wrote:

> Hello
> I wonder if I could ask for advice on how to construct a lazy sequence. My
> application might be of interest to some of you.
>
> The context for this is that I have an embedded system with very limited
> facilities for proper debugging.
> I have inserted a 'trace' facility in the embedded code that is able to
> emit binary bytes that I can capture over a serial comm channel.
> So, what I get is a stream of bytes that is a sort of mini-language.
>
> For example, I might get the values as in this seq:
>
>   (def bSeq [1 20 30 4 1 7 8 5 60 5 70])
>
> where the 'sentences' of this language are as follows:
>
> 1 a b (that is, a 1 is followed by two values),
> 4 (that is, a 4 is on its own)
> 5 x (that is, a 5 is followed by one value),  and so on.
>
> Now, examining this stream of values is tedious to say the least, so I want
> to parse it and print meaningful versions of the sentences (after all, I
> know what they really mean :).
> So, I construct a set of specifications for the sentences, like this:
>
> (defstruct Spec :nArgs :fmt)
>
> (def specs {
> 1 (struct Spec 2 "[1] a=%d b=%d\n")
> 4 (struct Spec 0 "[4]\n")
> 5 (struct Spec 1 "[5] z=%d\n")
> })
>
> The map of Specs is keyed by the value that starts the sentence.
> The Spec itself comprises :nArgs (how many values follow)
> and :fmt (a string for the format function, expecting :nArgs values, which
> will render the sentence in a useful way).
>
> I want to do the parsing of the byte sequence as follows, using the magic
> of reduce:
>
> (reduce parser {} bSeq)
>
> where the parser function is this:
>
>   (defn parser [m a]
> (if (empty? m)
>   (if-let [spec (specs a)]
> (if (zero? (spec :nArgs))
>   (do
> (print (format (spec :fmt)))
> {})
>   {:spec spec :args []})
> (throw (Error. (format "Input %d has no format spec" a
>   (let [newArgs (conj (m :args) a)]
> (if (= ((m :spec) :nArgs) (count newArgs))
>   (do
> (print (apply format ((m :spec) :fmt) newArgs))
> {})
>   (assoc m :args newArgs)
>
> To explain a bit: the args to parser are m, a map with keys:
>   :spec -- the spec of the sentence that is currently being parsed
>   :args -- a vector of the args to this sentence
> or the empty map if the next thing expected is the start value of a
> sentence;
> and a the next value in the sequence.
>
> Lo and behold, this produces formatted output like this:
>
> [1] a=20 b=30
> [4]
> [1] a=7 b=8
> [5] z=60
> [5] z=70
>
> So far so good, but here comes the real question of this post.
> The data arrives from the serial port in variable sized byte arrays at
> unpredictable moments in time; these are placed in a queue, like this:
>
> (def inputQ (java.util.concurrent.LinkedBlockingQueue.))
> (defn inputArrives [byteArray] (.put inputQ byteArray))
>
> It is of course very easy to read the things out of the queue by means of
> (.take inputQ), and then read the bytes one-by-one; of course this may block
> waiting for more inputs.
>
> So - how do I make a function that returns a lazy sequence that internally
> is getting the byte arrays off this queue and feeding the bytes contained
> therein to the caller of the lazy sequence - one byte at a time?
>
> And - a similar question (easier to answer I imagine) how do I construct a
> lazy sequence from the bytes read from a file (possibly with some
> translation between reading the raw bytes from the file and handing them
> over to the caller of the lazy sequence)?
>
> Of course, I could (and have) implemented all the above in a much more
> procedural kind of way, but it is so much more elegant (and easier to
> understand) with a lazy sequence :)
>
> Looking forward to some remarkable, simple solutions :)
>
> Regards, Tim
>
> PS Thinking about this makes me wonder about the existence, or
> non-existence of a 'super-reduce' function that could do context-free
> grammar parsing.
> Is such a thing possible? Is there-such a thing as a lazy back-trackable
> sequence? Now that I've asked - I'm not even sure what that means :))
>
> --
> 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 are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/cl

Aw: Help: how to construct lazy sequences

2011-05-19 Thread Meikel Brandmeyer
Hi,

how about this?

(def sentence-spec {1 {:n 2 :fmt "[1] a=%d b=%d"}
4 {:n 0 :fmt "[4]"}
5 {:n 1 :fmt "[5] z=%d"}})

(defn input-reader
  [inputQ eof?]
  (fn [byteArray]
(.put inputQ (or byteArray eof?

(defn input-bytes
  [inputQ eof?]
  (->> (repeatedly #(.take inputQ))
(take-while #(not (identical? % eof?)))
(mapcat identity)))

(defn sentence-seq
  [bytes-seq]
  (lazy-seq
(when-let [s (seq bytes-seq)]
  (let [{:keys [n fmt]} (sentence-spec (first s))
[sentence tail] (split-at n (rest s))]
(cons (apply format fmt sentence)
  (sentence-seq tail))

(defn the-app
  []
  (let [eof?   (Object.)
inputQ (LinkedBlockingQueue.)]
(init-serial-port (input-reader inputQ eof?))
(sentence-seq (input-bytes inputQ eof?

It uses a guard to detect EOF (assuming a nil "array" means EOF) and turns 
the input queue into a sequence of bytes. Then the translation to sentences 
is based on this input byte sequence.

Sincerely
Meikel

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Help: how to construct lazy sequences

2011-05-19 Thread timc
Hello
I wonder if I could ask for advice on how to construct a lazy sequence. My 
application might be of interest to some of you.

The context for this is that I have an embedded system with very limited 
facilities for proper debugging.
I have inserted a 'trace' facility in the embedded code that is able to emit 
binary bytes that I can capture over a serial comm channel.
So, what I get is a stream of bytes that is a sort of mini-language.

For example, I might get the values as in this seq:

  (def bSeq [1 20 30 4 1 7 8 5 60 5 70])

where the 'sentences' of this language are as follows:

1 a b (that is, a 1 is followed by two values),
4 (that is, a 4 is on its own)
5 x (that is, a 5 is followed by one value),  and so on.

Now, examining this stream of values is tedious to say the least, so I want 
to parse it and print meaningful versions of the sentences (after all, I 
know what they really mean :).
So, I construct a set of specifications for the sentences, like this:

(defstruct Spec :nArgs :fmt)

(def specs {
1 (struct Spec 2 "[1] a=%d b=%d\n")
4 (struct Spec 0 "[4]\n")
5 (struct Spec 1 "[5] z=%d\n")
})

The map of Specs is keyed by the value that starts the sentence.
The Spec itself comprises :nArgs (how many values follow)
and :fmt (a string for the format function, expecting :nArgs values, which 
will render the sentence in a useful way).

I want to do the parsing of the byte sequence as follows, using the magic of 
reduce:

(reduce parser {} bSeq)

where the parser function is this:

  (defn parser [m a]
(if (empty? m)
  (if-let [spec (specs a)]
(if (zero? (spec :nArgs))
  (do
(print (format (spec :fmt)))
{})
  {:spec spec :args []})
(throw (Error. (format "Input %d has no format spec" a
  (let [newArgs (conj (m :args) a)]
(if (= ((m :spec) :nArgs) (count newArgs))
  (do
(print (apply format ((m :spec) :fmt) newArgs))
{})
  (assoc m :args newArgs)

To explain a bit: the args to parser are m, a map with keys:
  :spec -- the spec of the sentence that is currently being parsed
  :args -- a vector of the args to this sentence
or the empty map if the next thing expected is the start value of a 
sentence;
and a the next value in the sequence.

Lo and behold, this produces formatted output like this:

[1] a=20 b=30
[4]
[1] a=7 b=8
[5] z=60
[5] z=70

So far so good, but here comes the real question of this post.
The data arrives from the serial port in variable sized byte arrays at 
unpredictable moments in time; these are placed in a queue, like this:

(def inputQ (java.util.concurrent.LinkedBlockingQueue.))
(defn inputArrives [byteArray] (.put inputQ byteArray))

It is of course very easy to read the things out of the queue by means of 
(.take inputQ), and then read the bytes one-by-one; of course this may block 
waiting for more inputs.

So - how do I make a function that returns a lazy sequence that internally 
is getting the byte arrays off this queue and feeding the bytes contained 
therein to the caller of the lazy sequence - one byte at a time?

And - a similar question (easier to answer I imagine) how do I construct a 
lazy sequence from the bytes read from a file (possibly with some 
translation between reading the raw bytes from the file and handing them 
over to the caller of the lazy sequence)?

Of course, I could (and have) implemented all the above in a much more 
procedural kind of way, but it is so much more elegant (and easier to 
understand) with a lazy sequence :)

Looking forward to some remarkable, simple solutions :)

Regards, Tim

PS Thinking about this makes me wonder about the existence, or non-existence 
of a 'super-reduce' function that could do context-free grammar parsing.
Is such a thing possible? Is there-such a thing as a lazy back-trackable 
sequence? Now that I've asked - I'm not even sure what that means :))

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: interest in STM, where can I start to get knowing well about it?

2011-05-19 Thread MohanR
So I think readng the actual STM source with Java' features might
help.

Are there actually books on this topic ? Peter Van roy's Data flow
concurrency book ?

Thanks,
Mohan

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: interest in STM, where can I start to get knowing well about it?

2011-05-19 Thread Ken Wesson
On Thu, May 19, 2011 at 3:13 AM, MohanR  wrote:
> I was perplexed too but I think most( or all ) of the concurrency
> features in Clojure is based on java.util.concurrent. I might be wrong
> about this though.

Certainly some of them are. Promise/deliver uses CountDownLatch. Atom
unsurprisingly is a wrapper around an AtomicReference. No doubt the
STM heavily uses java.util.concurrent classes under the hood as well.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure stack

2011-05-19 Thread Thorsten Wilms

On 05/19/2011 02:06 AM, Sean Corfield wrote:


I've actually found the Clojure community to be one of the most
welcoming and most helpful of almost any technology that I've picked
up in about 30 years. YMMV, I guess, and I'm sure it depends on your
programming background.


Same here, except 30 years ago, the technology I may have picked up 
would have included pacifiers :)


That said, setting things up to work with Clojure really feels like an 
investment, currently. http://try-clojure.org/ really helped me 
regarding motivation to get through it. I started using Emacs because of 
Clojure, after a failed attempt to set up CCW and I don't look back.


After initially installing a Clojure package on Ubuntu, I then learned 
that it was totally unnecessary for a project using Leiningen ...




Look at "([name doc-string? attr-map? [params*] body] [name doc-
string? attr-map? ([params*] body) + attr-map?])".



I'd instinctively expect something? to be optional and something* to
mean zero or more. Basic regex and something I've seen in
documentation for decades. I'm genuinely surprised you're asserting
there are developers out there who would not know that (I'm not
denying the possibility, just expressing surprise - it simply wouldn't
have occurred to me).


Despite using ? and * in bash, that was not clear to me. I even briefly 
thought about the use of ? to mark predicates, but of course that makes 
no sense, here. It's hard to get into the shoes of someone who doesn't 
know what you know. But all it takes in a case like this is about one or 
two sentences of explanation.




It's also worth saying that there is a perfectly defensible position
that says if you dumb down the documentation and offer too much
hand-holding, you will get an influx of programmers whose skill level
may lead to a lot of poor code that then gets Clojure a bad reputation
as an unmaintainable, poorly performing language. Don't think it can
happen? Look at Basic, CFML, PHP which all have a reputation for
poorly structured code because of too many n00bs being able to pick
them up easily and write bad code.


I even heard complaints about there being way too many bad examples out 
there for Python. Inevitable, at some point, if a PL goes mainstream, I 
guess. Luckily, you just need enough users to build a healthy 
eco-system, not take over the world.



--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/

--
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: interest in STM, where can I start to get knowing well about it?

2011-05-19 Thread MohanR
I was perplexed too but I think most( or all ) of the concurrency
features in Clojure is based on java.util.concurrent. I might be wrong
about this though.

So once you start programming java.util.concurrent you can learn
clojure STM. Someone who has more expertise can comment about this.

Thanks,
Mohan

-- 
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 are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en