ClojureScript keywords

2011-09-02 Thread Stuart Campbell
Hi,

When I compile the following to JavaScript, I expected it to output
foo in the console log:

  (.log js/console (name :foo))

However, it outputs ï· 'foo.

Is that right?

Regards,
Stuart

-- 
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


On Lisp with Clojure

2011-09-02 Thread Michael Jaaka
Hi!

Is there any project on github which goal is to implement all code
from On Lisp book in Clojure?
There are so many useful concepts. For example pattern maching looks
like Business Rules, Query Interpreter looks like Semantic Web
Repository and so on..

-- 
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: ClojureScript keywords

2011-09-02 Thread Stuart Campbell
Please excuse the self-reply;

Looking at the compiled version of (keyword?), I can see a line that appears
to compare the first character of the keyword string against a
multi-character string constant:

cljs.core.keyword_QMARK_ = (function keyword_QMARK_(x){
var and__3574__auto2211 = goog.isString.call(null,x);

if(cljs.core.truth_(and__3574__auto2211))
{*return cljs.core._EQ_.call(null,x.charAt(0),ï· );*
} else
{return and__3574__auto2211;
}
});

Stepping into cljs.core._EQ_ in the debugger shows that the first argument
is one character long, but the second is 3 characters long.

Is this just some encoding issue in my setup? I'm on Mac OS X 10.5, and I
got the same result in FF 6 and Chrome 13.

On 2 September 2011 17:41, Stuart Campbell 
stuart.william.campb...@gmail.com wrote:
 Hi,

 When I compile the following to JavaScript, I expected it to output
 foo in the console log:

  (.log js/console (name :foo))

 However, it outputs ï· 'foo.

 Is that right?

 Regards,
 Stuart

 --
 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: ClojureScript keywords

2011-09-02 Thread David Powell
Clojurescript represents symbols and keywords as strings with a one
character unicode prefix (as an implementation detail).

But, by default it outputs javascript as utf-8, and unless you are serving
javascript from a server and have setup the headers accordingly, this will
be misinterpreted by the browser as 3x iso-8859-1 characters.

However, if you run with the advanced compiler, it will escape everything to
ascii so you won't get these encoding issues.

There is a jira issue to make the unoptimised path do the same encoding as
the advanced compiler, but this isn't fixed yet.

-- 
Dave
On 2 Sep 2011 09:28, Stuart Campbell stuart.william.campb...@gmail.com
wrote:
 Please excuse the self-reply;

 Looking at the compiled version of (keyword?), I can see a line that
appears
 to compare the first character of the keyword string against a
 multi-character string constant:

 cljs.core.keyword_QMARK_ = (function keyword_QMARK_(x){
 var and__3574__auto2211 = goog.isString.call(null,x);

 if(cljs.core.truth_(and__3574__auto2211))
 {*return cljs.core._EQ_.call(null,x.charAt(0),ï· );*
 } else
 {return and__3574__auto2211;
 }
 });

 Stepping into cljs.core._EQ_ in the debugger shows that the first argument
 is one character long, but the second is 3 characters long.

 Is this just some encoding issue in my setup? I'm on Mac OS X 10.5, and I
 got the same result in FF 6 and Chrome 13.

 On 2 September 2011 17:41, Stuart Campbell 
 stuart.william.campb...@gmail.com wrote:
 Hi,

 When I compile the following to JavaScript, I expected it to output
 foo in the console log:

 (.log js/console (name :foo))

 However, it outputs ï· 'foo.

 Is that right?

 Regards,
 Stuart

 --
 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

-- 
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: ClojureScript keywords

2011-09-02 Thread Stuart Campbell
Thanks David.

I added meta charset=UTF-8 to my HTML document (this is just a static
test project) and it fixed the problem.

Regards,
Stuart

On 2 September 2011 18:36, David Powell d...@djpowell.net wrote:

 Clojurescript represents symbols and keywords as strings with a one
 character unicode prefix (as an implementation detail).

 But, by default it outputs javascript as utf-8, and unless you are serving
 javascript from a server and have setup the headers accordingly, this will
 be misinterpreted by the browser as 3x iso-8859-1 characters.

 However, if you run with the advanced compiler, it will escape everything
 to ascii so you won't get these encoding issues.

 There is a jira issue to make the unoptimised path do the same encoding as
 the advanced compiler, but this isn't fixed yet.

 --
 Dave
 On 2 Sep 2011 09:28, Stuart Campbell stuart.william.campb...@gmail.com
 wrote:
  Please excuse the self-reply;
 
  Looking at the compiled version of (keyword?), I can see a line that
 appears
  to compare the first character of the keyword string against a
  multi-character string constant:
 
  cljs.core.keyword_QMARK_ = (function keyword_QMARK_(x){
  var and__3574__auto2211 = goog.isString.call(null,x);
 
  if(cljs.core.truth_(and__3574__auto2211))
  {*return cljs.core._EQ_.call(null,x.charAt(0),ï· );*
  } else
  {return and__3574__auto2211;
  }
  });
 
  Stepping into cljs.core._EQ_ in the debugger shows that the first
 argument
  is one character long, but the second is 3 characters long.
 
  Is this just some encoding issue in my setup? I'm on Mac OS X 10.5, and I
  got the same result in FF 6 and Chrome 13.
 
  On 2 September 2011 17:41, Stuart Campbell 
  stuart.william.campb...@gmail.com wrote:
  Hi,
 
  When I compile the following to JavaScript, I expected it to output
  foo in the console log:
 
  (.log js/console (name :foo))
 
  However, it outputs ï· 'foo.
 
  Is that right?
 
  Regards,
  Stuart
 
  --
  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

 --
 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: On Lisp with Clojure

2011-09-02 Thread Eric Lavigne
 Is there any project on github which goal is to implement all code
 from On Lisp book in Clojure?

Michael Fogus and Stuart Halloway have both ported parts of On Lisp to Clojure.

Michael
http://blog.fogus.me/tag/onlisp/

Stuart
http://thinkrelevance.com/blog/2008/12/12/on-lisp-clojure.html
https://github.com/stuarthalloway/onlisp-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: is there a 4Clojure forum anywhere?

2011-09-02 Thread z_axis
Can http://try-clojure.org/; support pasting ?

On 8月27日, 上午10时08分, Alan Malloy a...@malloys.org wrote:
 I haven't heard of one either, and I'm maintainer and co-founder of
 4clojure. If someone (that means you!) starts such a forum, I'm happy
 to link to it from 4clojure proper.

 On Aug 26, 5:59 pm, Bob Shock shock...@gmail.com wrote:



  Is there a recovery group for 4clojure.com addicts?

  Stop now!

  Don't go further before it's too late and you are checking the website
  every five minutes waiting for the next problem, obsessing over every
  character in your code so you can get one of the best code golf
  scores, etc.

  But seriously, one of the greatest websites of its kind and kudos to
  the creators!

  I don't know of any discussion forums and probably would have stumbled
  on one over the past few weeks if there was one.

  On Aug 26, 3:53 pm, chepprey chepp...@gmail.com wrote:

   I've just started going through the problems onhttp://4clojure.com.
   Very fun.

   Does anyone know if there's a discussion forum dedicated to that
   site?  I've searched but nothing jumps out.

   I'm looking for a hint on how to solve the Nth Element problem
   (without cheating and using the nth function).

-- 
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


Broken Sequences screencast

2011-09-02 Thread Irakli Gozalishvili
Hi,

Not sure if this right place to report about this, but I could not thing of 
any better. I'm in a process of learning Clojure and I found screen-casts 
linked from clojure.org http://blip.tv/clojure very useful. Unfortunately 
thought [Clojure 
Sequences](http://blip.tv/clojure/clojure-sequences-740581) video is broken 
it plays 7secs and stops. Would be great if anyone could fixed that!

Regards

-- 
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

Unable to use/refer/require clojure.contrib

2011-09-02 Thread Ryan
I'm getting such strange results trying to use the clojure contrib
libraries (1.1.0). Some I can use, others I can only refer, but
some I can't do either. I'm using clojure-1.2.1 and clojure-
contrib-1.1.0 from: 
http://code.google.com/p/clojure-contrib/downloads/detail?name=clojure-contrib-1.1.0.zip.

java -cp c:/clj/clojure-contrib.jar;c:/clj/clojure.jar clojure.main
Clojure 1.2.1
user= (use 'clojure.contrib.str-utils)
nil
user=
user=
user= (use 'clojure.contrib.accumulators)
java.lang.NoSuchMethodError: clojure.lang.RestFn.init(I)V
(NO_SOURCE_FILE:0)
user= (refer 'clojure.contrib.accumulators)
nil
user=
user=
user= (use 'clojure.contrib.repl-utils)
java.lang.NoSuchMethodError: clojure.lang.RestFn.init(I)V
(NO_SOURCE_FILE:0)
user= (refer 'clojure.contrib.repl-utils)
java.lang.IllegalStateException: source already refers to:
#'clojure.repl/source in namespace: user (NO_SOURCE_FILE:0)
user= (require 'clojure.contrib.repl-utils)
java.lang.NoClassDefFoundError: Could not initialize class
clojure.contrib.repl_utils__init (NO_SOURCE_FILE: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: Top secret clojure project names

2011-09-02 Thread Wilker
Never say bug free, the bugs will hear...
---
Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600



On Thu, Sep 1, 2011 at 8:47 PM, Islon Scherer islonsche...@gmail.comwrote:

 I have a big clojure project at work but it's not a secret. It
 superseded a old java project, the clojure one is 50 times smaller, 10
 times faster and bug free. They had no choice but to accept the new
 one =)

 On Sep 1, 6:54 pm, Sean Corfield seancorfi...@gmail.com wrote:
  On Thu, Sep 1, 2011 at 2:31 PM, JAX jayunit...@gmail.com wrote:
   Hi guys: I assume some of you have secret Clojure projects at work,
 that your bosses don't know about.
 
  LOL! That would be hard for me - every commit and every ticket update
  / comment is emailed to the whole project team which includes
  management :)
 
  It does pose an interesting question tho': how many folks are using
  skunkwork projects to introduce Clojure vs opening getting buy in up
  front?
  --
  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


-- 
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

Eval in future ... Bug or feature?

2011-09-02 Thread Nils Bertschinger
Hi everyone,

it appears that eval works differently when used inside a future. The
following example REPL session shows what I mean:

user (clojure-version)
1.2.0-master-SNAPSHOT
user (defn my-inc [x] (+ x 1))
#'user/my-inc
user (eval '(my-inc 1))
2
user (future (eval '(my-inc 1)))
#core$future_call$reify__5496@18c92d9: :pending
user (deref *1)
java.lang.Exception: Unable to resolve symbol: my-inc in this context
(NO_SOURCE_FILE:1)
  [Thrown class java.util.concurrent.ExecutionException]

I found this rather strange. Does anyone know why this happens and
whether it is actually intended? Is it a bug or a feature ;-).

Best,

Nils

-- 
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 a serie list

2011-09-02 Thread Wilker
Hi Guys,

I'm just starting with Clojure (finished reading Programming Clojure, from
PragProg).
I mean may question should be really newbie, but I'm still confused about
all functional stuff...

I have this test code:

(def subdb-test-data {:dexter{:path fixtures/dexter.mp4,:hash
ffd8d4aa68033dc03d1c8ef373b9028c}
  :justified {:path fixtures/justified.mp4, :hash
edc1981d6459c6111fe36205b4aff6c2}})

(deftest test-compute-hash
  (let [{:keys [path hash]} (subdb-test-data :dexter)]
(is (= hash (subdb-hash path)) hash don't match)))

It's currently testing only the first video, on test-data I have the video
path and the expected hash, and the test should check if hash is being
generated correctly.
My problem is, I wanna do somekind of loop and test each entry on test-data,
all in one, I tried some (for) loops but it made the test run no assertion
at all... This is my (for) trial (don't works):

(deftest test-compute-hash
  (for [{:keys [path hash]} (vals subdb-test-data)]
(is (= hash (subdb-hash path)) hash don't match)))

How I can make this works? I will need to create a macro for that (I hope
not...)?
---
Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600

-- 
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: test a serie list

2011-09-02 Thread Tassilo Horn
Wilker wilkerlu...@gmail.com writes:

 My problem is, I wanna do somekind of loop and test each entry on
 test-data, all in one, I tried some (for) loops but it made the test
 run no assertion at all... This is my (for) trial (don't works):

 (deftest test-compute-hash
   (for [{:keys [path hash]} (vals subdb-test-data)]
 (is (= hash (subdb-hash path)) hash don't match)))

 How I can make this works? I will need to create a macro for that (I hope
 not...)?

`for' is lazy.  It computes its result seq not before you access its
elements.  You want to iterate over the entries of your map only for
side-effects (the `is' test).  In that case, use `doseq'.

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: ClojureScript and lein?

2011-09-02 Thread Jim Blomo
On Mon, Aug 29, 2011 at 6:09 PM, Eric Lavigne lavigne.e...@gmail.com wrote:
 So the other thought is why can the lein do the job? Has anyone tried?

 Someone has created a Leiningen-installable ClojureScript compiler,
 including automatic recompilation when your source code changes.
 Unfortunately, I haven't been able to make it work on my computer, but
 you could still give it a try.

     https://github.com/ibdknox/noir-cljs

I've also just uploaded
https://github.com/jblomo/ring.middleware.clojurescript and
compojure.route.clojurescript, if your code isn't noir specific.  Let
me know if they work for you.  Cheers,

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: Eval in future ... Bug or feature?

2011-09-02 Thread Vijay Lakshminarayanan
Nils Bertschinger nils.bertschin...@googlemail.com writes:

 Hi everyone,

 it appears that eval works differently when used inside a future. The
 following example REPL session shows what I mean:

 user (clojure-version)
 1.2.0-master-SNAPSHOT
 user (defn my-inc [x] (+ x 1))
 #'user/my-inc
 user (eval '(my-inc 1))
 2
 user (future (eval '(my-inc 1)))
 #core$future_call$reify__5496@18c92d9: :pending
 user (deref *1)
 java.lang.Exception: Unable to resolve symbol: my-inc in this context
 (NO_SOURCE_FILE:1)
   [Thrown class java.util.concurrent.ExecutionException]

 I found this rather strange. Does anyone know why this happens and
 whether it is actually intended? Is it a bug or a feature ;-).

I don't have any problems...

$ java -jar clojure-1.3.0-alpha8.jar
Clojure 1.3.0-alpha8
user= (defn my-inc [x] (+ x 1))
#'user/my-inc
user= (eval '(my-inc 1))
2
user= (future (eval '(my-inc 1)))
#core$future_call$reify__5735@61736e: 2
user= (deref *1)
2

 Best,

 Nils

-- 
Cheers
~vijay

-- 
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


not= counterintuitive?

2011-09-02 Thread ax2groin
This code doesn't return the value I intuitively expect:

  user= (not= 1 2 1)
  true

When I write that, I was expecting the equivalent of (and (= 1 2) (= 1
1)), but the macro expansion is essentially (not (= 1 2 1)).

Note: This came out of the :while condition of a (for) expression not
returning what I expected on three separate values, where (= x z).

I can work around it to get what I want, but I was curious if perhaps
the (not=) was not in the spirit it was intended.

-- 
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: not= counterintuitive?

2011-09-02 Thread Mark Engelberg
On Fri, Sep 2, 2011 at 11:14 AM, ax2groin ax2gr...@gmail.com wrote:

 This code doesn't return the value I intuitively expect:

  user= (not= 1 2 1)
  true

 This is exactly what I expect. Those values are not all equal.

-- 
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: not= counterintuitive?

2011-09-02 Thread Laurent PETIT
2011/9/2 Mark Engelberg mark.engelb...@gmail.com


 On Fri, Sep 2, 2011 at 11:14 AM, ax2groin ax2gr...@gmail.com wrote:

 This code doesn't return the value I intuitively expect:

  user= (not= 1 2 1)
  true

 This is exactly what I expect. Those values are not all equal.


same for me


  --
 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

Finite lazy sequence

2011-09-02 Thread Wilker
Hi guys,

I'm writing a simple parser here, and for parsing I'm creating a
lazy-sequence this way:

(defn tokens-sec [string]
  (iterate (fn [info] (next-token info)) [0 0 string []]))

but there is a problem, this sequence has a limit (that's when there are no
more tokens to consume).
How I stop the iteration?? How I signal that it reached the end? I tried:

(defn tokens-sec [string]
  (iterate (fn [[_ _ string] :as info]
 (if ( (count string) 0) (next-token info))) [0 0 string []]))

but no lucky...

There is any way to signal to iterate that list reached the end? Or there is
another way that I can't see to make this lazy list works this way?
---
Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600

-- 
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: Finite lazy sequence

2011-09-02 Thread Wilker
Solved by wrapping iterate on take-while :)

(defn tokens-sec [string]
  (take-while identity
(iterate (fn [[_ _ string :as info]]
   (if ( (count string) 0) (next-token info))) [0 0 string
[]])))

---
Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600



On Fri, Sep 2, 2011 at 3:46 PM, Wilker wilkerlu...@gmail.com wrote:

 Hi guys,

 I'm writing a simple parser here, and for parsing I'm creating a
 lazy-sequence this way:

 (defn tokens-sec [string]
   (iterate (fn [info] (next-token info)) [0 0 string []]))

 but there is a problem, this sequence has a limit (that's when there are no
 more tokens to consume).
 How I stop the iteration?? How I signal that it reached the end? I tried:

 (defn tokens-sec [string]
   (iterate (fn [[_ _ string] :as info]
  (if ( (count string) 0) (next-token info))) [0 0 string []]))

 but no lucky...

 There is any way to signal to iterate that list reached the end? Or there
 is another way that I can't see to make this lazy list works this way?
 ---
 Wilker Lúcio
 http://about.me/wilkerlucio/bio
 Kajabi Consultant
 +55 81 82556600



-- 
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-based non-blocking webserver like Node.js

2011-09-02 Thread billh2233
Is there a clojure-based webserver that uses non-blocking IO like
Node.js, or any effort like that being considered?

I like Node.js's non-blocking IO for performance reasons, though it is
built around a single-threaded model whereas clojure is built around a
multi-core/concurrency model.  I wonder if the two concepts can be
combined somehow.

Thoughts?

-- 
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-based non-blocking webserver like Node.js

2011-09-02 Thread Laurent PETIT
Hi,

AFAIK, there's a java version of node.js, called Node.x :
https://github.com/purplefox/node.x

HTH,

-- 
Laurent

2011/9/2 billh2233 bill.har...@gmail.com

 Is there a clojure-based webserver that uses non-blocking IO like
 Node.js, or any effort like that being considered?

 I like Node.js's non-blocking IO for performance reasons, though it is
 built around a single-threaded model whereas clojure is built around a
 multi-core/concurrency model.  I wonder if the two concepts can be
 combined somehow.

 Thoughts?

 --
 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: clojure-based non-blocking webserver like Node.js

2011-09-02 Thread Wilson MacGyver
look at https://github.com/ztellman/aleph

it supprorts async, websocket, server side and client side, plus has
redis support.
very happy with it.

On Fri, Sep 2, 2011 at 2:20 PM, billh2233 bill.har...@gmail.com wrote:
 Is there a clojure-based webserver that uses non-blocking IO like
 Node.js, or any effort like that being considered?

 I like Node.js's non-blocking IO for performance reasons, though it is
 built around a single-threaded model whereas clojure is built around a
 multi-core/concurrency model.  I wonder if the two concepts can be
 combined somehow.

 Thoughts?

 --
 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



-- 
Omnem crede diem tibi diluxisse supremum.

-- 
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-based non-blocking webserver like Node.js

2011-09-02 Thread Raoul Duke
On Fri, Sep 2, 2011 at 11:20 AM, billh2233 bill.har...@gmail.com wrote:
 I like Node.js's non-blocking IO for performance reasons, though it is
 built around a single-threaded model whereas clojure is built around a
 multi-core/concurrency model.  I wonder if the two concepts can be
 combined somehow.

* python lets you combine processes, pre-emptive threads, and
coroutines. see the greenlet stuff.

* class threads are heavy and context switches suck and that is one
reason people don't like them vs. the node.js speeds. however, look at
Erlang since it has very low context switching overhead, since it
doesn't use OS threads.
http://thatclevershark.org/benchmarks.html

* theoretically, threads and event-driven styles are duals of each
other, or maybe the same thing at some level.
http://lamp.epfl.ch/~phaller/doc/haller07actorsunify.pdf
http://www.bluishcoder.co.nz/2006/04/unifying-events-and-threads-in-haskell.html

sincerely.

-- 
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-based non-blocking webserver like Node.js

2011-09-02 Thread Michael Klishin
2011/9/2 billh2233 bill.har...@gmail.com

 Is there a clojure-based webserver that uses non-blocking IO like
 Node.js, or any effort like that being considered?


Java ecosystem has at least two very mature asynchronous I/O libraries:
Netty and Apache MINA.

Several Clojure projects that use Netty (http://www.jboss.org/netty):

https://github.com/ztellman/aleph
https://github.com/strobecorp/picard
https://github.com/texodus/saturnine

-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
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

== is not always transitive

2011-09-02 Thread Patrick Houk
Greetings,

I think that I've encountered a bug in ==.

user= (and (== 1 1.0) (== 1.0 1.0M) (not (== 1 1.0M)))
true

This happens with 1.2.1 and 1.3-beta2.  I think it has to do with the
precision of the BigDecimal.

user= (== 1 1.0M)
false
user= (== 1 1M)
true

I think a solution would be to use BigDecimal#compareTo (or maybe
BigDecimal#stripTrailingZeros) in ==, so that (== 1M 1.0M) becomes
true.  (I would expect (= 1M 1.0M) to remain false, though.)

Thanks,
- Pat

-- 
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: http-client and ignoring ssl errors

2011-09-02 Thread John Newman
Maybe I should just build the SSL logic into http-client.core/request and
have request instantiate a different DefaultHttpClient based on the value of
:noauth in the request map?

Will try when I get home.

John


On Thu, Sep 1, 2011 at 4:31 PM, John Newman john...@gmail.com wrote:

 Hello All,

 I am trying to add some functionality to http-client.  Basically, I need
 the ability to do get requests on a server while ignoring ssl errors.  Once
 I figure out how to get it working, I'll put it up on github and people can
 pull it if they'd like.

 I am working from a fork of http-client that has support for cookies,
 located here: https://github.com/r0man/clj-http/commits/cookies

 I used r0man's changes (
 https://github.com/r0man/clj-http/commit/f8152c6182c148539148fdc7f77faab14b7567c3)
 as an example of what I needed to change in order to add ssl error ignore
 capability.

 I used some java wisdom from stackoverflow (
 http://stackoverflow.com/questions/2012497/accepting-a-certificate-for-https-on-android/3904473#3904473)
 to ignore ssl errors.

 I came up with this:

 src/http-client/client.clj

 ...
   (:use [clj-http.cookies :only (wrap-cookies)]
 [clj-http.noauth :only (wrap-noauth)])))
 ...
 and
 ...
 (defn wrap-request
   Returns a battaries-included HTTP request function coresponding to the
 given
core client. See client/client.
   [request]
   (- request
 wrap-noauth
 wrap-redirects
 wrap-exceptions
 ...

 I put wrap-noauth (which might have been a bad name) at the beginning
 because it takes the old client and actually returns a new one:

 src/http-client/noauth.clj

 (ns clj-http.noauth
   Allows client to ignore some SSL errors (only use in dev!)
   (:import (javax.net.ssl HostnameVerifier HttpsURLConnection))
   (:import (org.apache.http.conn.ssl SSLSocketFactory
 X509HostnameVerifier))
   (:import (org.apache.http.conn.scheme Scheme SchemeRegistry))
   (:import (org.apache.http.impl.client DefaultHttpClient))
   (:import (org.apache.http.impl.conn SingleClientConnManager)))

 (defn wrap-noauth [client]
   (fn [req]
 (if (:noauth req)
   (let [registry (SchemeRegistry.)
 hostname-verifier SSLSocketFactory/ALLOW_ALL_HOSTNAME_VERIFIER
 socket-factory (SSLSocketFactory/getSocketFactory)
 _ (.setHostnameVerifier
 socket-factory hostname-verifier)
 _ (.register registry (Scheme. https socket-factory 443))
 noauth-client (DefaultHttpClient.
 (SingleClientConnManager. (.getParams client)
 registry)
 (.getParams client))
 _ (HttpsURLConnection/setDefaultHostnameVerifier
 hostname-verifier)]
 (noauth-client req))
   (client req
 I essentially modeled wrap-noauth on the stackoverflow thread.

 When I run (c/get my-url {:noauth true :cookies ...

 I get:

 user= IllegalArgumentException No matching field found: getParams for
 class clojure.lang.Var  clojure.lang.Reflector.getInstanceField
 (Reflector.java:289)

 Taking the ':noauth true' out of the argument map makes the error go away.

 The only place I see getParams used is towards the beginning of the request
 function in core.clj

 src/http-client/core.clj
 ...
   (let [http-client (DefaultHttpClient.)]
 (try
   (- http-client
 (.getParams)
 (.setParameter ClientPNames/COOKIE_POLICY
 CookiePolicy/BROWSER_COMPATIBILITY))
   (let [http-url (str scheme :// server-name
 ...

 I'm still not sure what is going on... Am I breaking it by instantiating a
 new DefaultHttpClient?  Should a new key for noauth be put in the parameters
 to core/request [{:keys [noauth...  the cookies branch didn't do this, so I
 wasn't sure.

 Thanks in advance for the help.  Hopefully, once this is figured out, it
 will be useful to others as well.

 John


-- 
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: not= counterintuitive?

2011-09-02 Thread Alan Malloy
On Sep 2, 11:14 am, ax2groin ax2gr...@gmail.com wrote:
 This code doesn't return the value I intuitively expect:

   user= (not= 1 2 1)
   true

 When I write that, I was expecting the equivalent of (and (= 1 2) (= 1
 1)), but the macro expansion is essentially (not (= 1 2 1)).

This is not a macro.

-- 
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


Land of Lisp music video

2011-09-02 Thread finbeu
Just found this:

http://www.youtube.com/watch?v=HM1Zb3xmvMc

Awesome ...


-- 
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: Unable to use/refer/require clojure.contrib

2011-09-02 Thread Stuart Sierra
Hi Ryan,

Clojure-contrib versions 1.1.0 and 1.2.0 work only with the matching 
major.minor Clojure version.

So if you're using Clojure 1.2.0 or 1.2.1, you need to use clojure-contrib 
1.2.0.

Starting with 1.3, Clojure contrib is many libraries, each with their own 
independent version numbers.  See 
http://dev.clojure.org/display/doc/Clojure+Contrib

http://clojure.org/downloads has links to the latest releases.

Thanks,
-Stuart Sierra
clojure.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: not= counterintuitive?

2011-09-02 Thread ax2groin
That's what I get for posting a question while feeding a 1-year-old
child and getting ready to leave for lunch.

I was trying to put together a (for) construct to output the
combinations of a set, and my logic was flawed.

Here's what I really wanted [for sets of 3]:

(for [m x n x o x :while (and (not= m n) (not= m o) (not= n o))] [m n
o])

Maybe not the most efficient, but the smallest construct I've come up
with, but it isn't generic enough for me yet.

I'll keep working on 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: Land of Lisp music video

2011-09-02 Thread Tassilo Horn
finbeu info_pe...@t-online.de writes:

 Just found this:

 http://www.youtube.com/watch?v=HM1Zb3xmvMc

 Awesome ...

Totally.  Now I'll have a earwig for weeks.

Bye,
Tassilo

...simple but refined, guaranteed to blow your mind...

-- 
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: Land of Lisp music video

2011-09-02 Thread Wilker
Because of you I know had to spend $40 do get this e-book :P
hehe
---
Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600



On Fri, Sep 2, 2011 at 6:59 PM, Tassilo Horn tass...@member.fsf.org wrote:

 finbeu info_pe...@t-online.de writes:

  Just found this:
 
  http://www.youtube.com/watch?v=HM1Zb3xmvMc
 
  Awesome ...

 Totally.  Now I'll have a earwig for weeks.

 Bye,
 Tassilo

 ...simple but refined, guaranteed to blow your mind...

 --
 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

new Getting Started page

2011-09-02 Thread nchurch
There was some discussion about the Getting Started page last night at
the Bay Area meetup.  I've put together an (I think) improved version
at

http://dev.clojure.org/display/doc/Getting+Started+for+Beginners

Any suggestions/additions/deletions?  If this overall looks good, may
I replace the current page at

http://dev.clojure.org/display/doc/Getting+Started

with this one?  I'd put the current page under other options,
because it gives a lot of choices.

My hope was to give a relatively clean path for beginners (who are the
audience for Getting Started), instead of just throwing everything
there is at them without comment.  Someone who has been around Clojure
for a while knows that Lein is much more standard than Gradle, but to
a reader of the current Getting Started page they look the same.

-- 
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: new Getting Started page

2011-09-02 Thread Sean Corfield
I think this is a much better on ramp for folks new to Clojure and the
bullet list of the current Getting Started page really should be
the next page not the first one.

On Fri, Sep 2, 2011 at 3:13 PM, nchurch nchubr...@gmail.com wrote:
 There was some discussion about the Getting Started page last night at
 the Bay Area meetup.  I've put together an (I think) improved version
 at

 http://dev.clojure.org/display/doc/Getting+Started+for+Beginners

 Any suggestions/additions/deletions?  If this overall looks good, may
 I replace the current page at

 http://dev.clojure.org/display/doc/Getting+Started

 with this one?  I'd put the current page under other options,
 because it gives a lot of choices.

 My hope was to give a relatively clean path for beginners (who are the
 audience for Getting Started), instead of just throwing everything
 there is at them without comment.  Someone who has been around Clojure
 for a while knows that Lein is much more standard than Gradle, but to
 a reader of the current Getting Started page they look the same.

-- 
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: Eval in future ... Bug or feature?

2011-09-02 Thread Sean Corfield
Looks like it doesn't work in 1.2.1 but does work in 1.3.0:

(! 516)- lein repl
REPL started; server listening on localhost port 61980
user= (clojure-version)
1.2.1
user=  (defn my-inc [x] (+ x 1))
#'user/my-inc
user=  (eval '(my-inc 1))
2
user= (future (eval '(my-inc 1)))
java.lang.Exception: Unable to resolve symbol: my-inc in this context
user= ^D

Fri Sep 02 15:37:24
(sean)-(jobs:0)-(~/clojure/stable)
(! 517)- cd ../beta1/

Fri Sep 02 15:37:30
(sean)-(jobs:0)-(~/clojure/beta1)
(! 518)- lein repl
REPL started; server listening on localhost port 48094
user= (clojure-version)
1.3.0-beta1
user= (defn my-inc [x] (+ x 1))
#'user/my-inc
user= (eval '(my-inc 1))
2
user= (future (eval '(my-inc 1)))
#core$future_call$reify__5733@739abd2b: 2
user= (deref *1)
2
user=
-- 
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


A bit of fun with core.logic

2011-09-02 Thread Ambrose Bonnaire-Sergeant
Hi,

For those with a bit of free time to experiment at a REPL this weekend.

https://github.com/frenchy64/Logic-Starter/wiki/Arithmetic

Thanks,
Ambrose

-- 
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-based non-blocking webserver like Node.js

2011-09-02 Thread Tal Liron
Jetty and Grizzly also work great, and can be used as easily swappable 
connectors for Restlet, which in turn is used by Prudence's Clojure flavor 
(I'm the lead developer):

http://threecrickets.com/prudence/

Jetty is the most mature of the bunch (Grizzly, Netty, MINA, etc.) and 
offers many more features.

I always ask, though, why people think they need async I/O for a web server. 
Async might be important if you are streaming video, audio, etc. (And if you 
are, you're probably better off with a robust CDN.) But if your goal is to 
dynamically produce HTML, then async is close to meaningless: in the end, 
there must be a thread that generates the HTML (or fetched it from a cache), 
and that thread is likely in a pool. Sure, the socket may be read 
asynchronously, but you still have a thread pool at the top, with all the 
concerns to scalability that it entails.

In fact, it's well known that some of the best performing static-file web 
servers are not async. For static-file web servers, async might help 
scalability, not performance (often these qualities are in opposition): it 
can help you degrade more gracefully per client under *very* high 
concurrency. But, depending on what you're doing, any kind of degradation 
may be unacceptable, and the real solution is probably to scale up/out.

I wrote a long article examining these challenges as part of the Prudence 
Manual. There is a section that addresses async, and also highlights a 
select few use cases for it:

http://threecrickets.com/prudence/scaling/#toc-Subsubsection-151

-- 
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 bit of fun with core.logic

2011-09-02 Thread David Nolen
Good stuff!

On Fri, Sep 2, 2011 at 7:58 PM, Ambrose Bonnaire-Sergeant 
abonnaireserge...@gmail.com wrote:

 Hi,

 For those with a bit of free time to experiment at a REPL this weekend.

 https://github.com/frenchy64/Logic-Starter/wiki/Arithmetic

 Thanks,
 Ambrose

 --
 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: new Getting Started page

2011-09-02 Thread jonathan.watmo...@gmail.com
Is there any reason why the 'Getting Started' shouldn't essentially
follow
the form:

1. Download clojure and unzip
2. Move to the folder and type 'java -cp clojure.jar clojure.main' in
a terminal

For the sake of testing your new page, I downloaded clooj (ugly ugly
name)
and ran it. On trying to create a project, the first question after
specifying
a project folder was:

Please enter a fully-qualified namespace
[ ]

huh? This is hardly the kind of thing that's conducive to playing
about happily
discovering functional programming. Can I have multiple prompts in
clooj? Can
I easily pull in clojure files. Where do I specify other jars?
Classpath?

There's a huge set of advantages to starting in a terminal:

1. You can *see* the line that starts Clojure. If something's broken,
you have
a starting point.
2. You can easily add jars.
3. You can start multiple terminal windows to try different things.
4. You can use your preferred editors, anything from notepad+ up,
instead of
some incomplete 'IDE' [Note: without starting a project, typing in the
bottom
right window executed commands with the input and output sort of
interleaved,
but without my input shown against user=, instead shown below it.]

I'd suggest that having beginners to the language start off in a
terminal typing
into a REPL is absolutely the best possible thing. Packaging a
jReadline would
be smart too.

Thanks, and I shall now go back into hibernation.
Jonathan


On Sep 2, 5:34 pm, Sean Corfield seancorfi...@gmail.com wrote:
 I think this is a much better on ramp for folks new to Clojure and the
 bullet list of the current Getting Started page really should be
 the next page not the first one.







 On Fri, Sep 2, 2011 at 3:13 PM, nchurch nchubr...@gmail.com wrote:
  There was some discussion about the Getting Started page last night at
  the Bay Area meetup.  I've put together an (I think) improved version
  at

 http://dev.clojure.org/display/doc/Getting+Started+for+Beginners

  Any suggestions/additions/deletions?  If this overall looks good, may
  I replace the current page at

 http://dev.clojure.org/display/doc/Getting+Started

  with this one?  I'd put the current page under other options,
  because it gives a lot of choices.

  My hope was to give a relatively clean path for beginners (who are the
  audience for Getting Started), instead of just throwing everything
  there is at them without comment.  Someone who has been around Clojure
  for a while knows that Lein is much more standard than Gradle, but to
  a reader of the current Getting Started page they look the same.

-- 
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: Eval in future ... Bug or feature?

2011-09-02 Thread Brian Goslinga
The future is probably executing in a different thread, so the dynamic
binding of *ns* probably isn't the user namespace.

-- 
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: new Getting Started page

2011-09-02 Thread Lee Spector

FWIW I think nchurch's proposed new page is very nice and I disagree with 
almost all of jonathan.watmough's critiques. 

I won't rebut them all systematically, but one top-level issue is that I think 
that a reasonable getting-started path should include an editor with at least 
minimal language-aware editing features (bracket matching and 
auto-re-indenting) and that it should not require elaborate setup/config steps 
or prior understanding of JVM concepts. By this measure I think that clooj is a 
great starting point (with a great name!), and that a getting started page that 
suggests clooj as a first step while also directing people to more 
sophisticated approaches would be a great service to the community.

I do agree that clooj could still be improved. For example, it's unfortunate 
that clooj's repl currently separates input and output into two unlabeled 
panes, and I'd love to see either labels or a more normal input+output repl 
pane. But all-in-all I think clooj is the best currently available option for 
newcomers and that it'll be even better soon since it is new and under active 
development. I'm not one of the developers but I've been making lots of 
suggestions, which have been acted on promptly and intelligently, and I plan to 
teach with it starting next week. I'm also using a combination of clooj and 
lein for my own work, and at least for my purposes this seems to provide 
everything that I need with minimal hassles.

 -Lee


On Sep 2, 2011, at 8:27 PM, jonathan.watmo...@gmail.com wrote:

 Is there any reason why the 'Getting Started' shouldn't essentially
 follow
 the form:
 
 1. Download clojure and unzip
 2. Move to the folder and type 'java -cp clojure.jar clojure.main' in
 a terminal
 
 For the sake of testing your new page, I downloaded clooj (ugly ugly
 name)
 and ran it. On trying to create a project, the first question after
 specifying
 a project folder was:
 
 Please enter a fully-qualified namespace
 [ ]
 
 huh? This is hardly the kind of thing that's conducive to playing
 about happily
 discovering functional programming. Can I have multiple prompts in
 clooj? Can
 I easily pull in clojure files. Where do I specify other jars?
 Classpath?
 
 There's a huge set of advantages to starting in a terminal:
 
 1. You can *see* the line that starts Clojure. If something's broken,
 you have
 a starting point.
 2. You can easily add jars.
 3. You can start multiple terminal windows to try different things.
 4. You can use your preferred editors, anything from notepad+ up,
 instead of
 some incomplete 'IDE' [Note: without starting a project, typing in the
 bottom
 right window executed commands with the input and output sort of
 interleaved,
 but without my input shown against user=, instead shown below it.]
 
 I'd suggest that having beginners to the language start off in a
 terminal typing
 into a REPL is absolutely the best possible thing. Packaging a
 jReadline would
 be smart too.
 
 Thanks, and I shall now go back into hibernation.
 Jonathan
 

-- 
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: new Getting Started page

2011-09-02 Thread nchurch
Jonathan---

I think some of your criticisms of Clooj are valid, as Lee has said;
my question is not whether Clooj is perfect or even good, my question
is if there is a better option for an outright newcomer.  An outright
newcomer may not be so worried about adding jars, or used to existing
REPL behavior; an outright newcomer cannot be assumed to know anything
about running java at the command line (and having to run Clojure from
the directory where it is installed seems pretty ad-hoc and unclean
anyhow).  Finally, when it does come time to add jars, he should be
looking at Lein, as I suggested.

(One thing this reminds me of is that especially in the post-Lion era,
we should remind users to intall java if they have not already done
so.)

The suggestion to make Clooj the starting point actually came about
from the group, as you can see in the thread below:

http://groups.google.com/group/clojure/browse_thread/thread/5c4c36afcd73b24e/a8e3b4c6ac7b20a0?lnk=gstq=clooj#a8e3b4c6ac7b20a0

In any case, aside from Clooj, do you have any other issues with my
proposed Getting Started page, or do you think the current Getting
Started page is better?

(It's worth pointing out that the java -cp command is already on
clojure.org, so I'm not sure if we need to repeat it on dev.clojure.)

Thanks,

Nick.

-- 
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: new Getting Started page

2011-09-02 Thread Jeff Heon
I like the new page, and I do think Clooj is filling a much needed (or
at least much wanted) space for beginners to both Clojure and Java,
especially for those who have been accustomed to the practical IDLE
while learning Python.

I'm reasonably experienced in both Java  Clojure, and I use the
Eclipse plugin at work, but I find it useful to Clooj on my netbook
while commuting or at home. Clooj is portable Clojure 8)

P.S. + 1 on the name

-- 
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


[ANN] Clojure 1.3 Beta 3

2011-09-02 Thread Christopher Redinger
Clojure 1.3 Beta 3 is now available at 

http://clojure.org/downloads

The list of changes:
* Load resources when baseLoader() is null (CLJ-673)
* Equiv overload added for primitive booleans
* Documentation updates for juxt and defrecord (CLJ-815, CLJ-736 
respectively)

We think this is ready to be tagged as the 1.3 release. Any showstopper bugs 
that cause you to disagree? Let us know!

Thanks!

--
Chris Redinger
Clojure/core
http://clojure.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: new Getting Started page

2011-09-02 Thread Sean Corfield
On Fri, Sep 2, 2011 at 5:27 PM, jonathan.watmo...@gmail.com
jonathan.watmo...@gmail.com wrote:
 1. Download clojure and unzip
 2. Move to the folder and type 'java -cp clojure.jar clojure.main' in
 a terminal

Because this is exactly what's wrong with the current getting started
process. It's not n00b-friendly, esp. to people coming in from outside
the Java space.

 There's a huge set of advantages to starting in a terminal:

If you're not a Windows user?

I'm not a Windows user. I've been a Unix developer for many decades,
but I deal with a lot of Windows developers and expecting them to do
everything on the command line is a complete non-starter.

 2. You can easily add jars.

This means nothing to people coming from outside the Java world.

 3. You can start multiple terminal windows to try different things.

Not a good approach for Windows users.

 4. You can use your preferred editors

This is a valid comment. If you already have a preferred editor, we
should guide you to how to do Clojure development with that editor. I
think it's interesting that a lot of Clojurians use Emacs but outside
of the Clojure community I don't know _anyone_ who uses Emacs. It's
probably a good tweak to Nick's page to add a rider that if you have a
preferred editor, go read _this_ page..
-- 
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: Land of Lisp music video

2011-09-02 Thread Timothy Washington
Brilliant. I love it :)

Tim Washington
twash...@gmail.com
416.843.9060



On Fri, Sep 2, 2011 at 4:11 PM, finbeu info_pe...@t-online.de wrote:

 Just found this:

 http://www.youtube.com/watch?v=HM1Zb3xmvMc

 Awesome ...


  --
 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: new Getting Started page

2011-09-02 Thread Kevin Downey
I largely agree, what more do you need to get started than just a
repl? writing functions and run them. The bells and whistles you get
from various editors and ides are not a requirement for having fun
writing functions and running them.

It is great to let people know how to get a good integrated Clojure
setup in their favorite environment, but in no way is that needed to
get started with Clojure.

I think the big gap is what to do after you have gotten started,
because Clojure brings in so many devs who are not familiar with the
JVM. The on ramp for these devs is rocky because they often look down
on Java and the copious amount of documentation for various parts of
Java and the JVM. If we want to cater to these devs the best thing
would be to add some introductory material about the classpath, jar
files, and whatever else.

On Fri, Sep 2, 2011 at 5:27 PM, jonathan.watmo...@gmail.com
jonathan.watmo...@gmail.com wrote:
 Is there any reason why the 'Getting Started' shouldn't essentially
 follow
 the form:

 1. Download clojure and unzip
 2. Move to the folder and type 'java -cp clojure.jar clojure.main' in
 a terminal

 For the sake of testing your new page, I downloaded clooj (ugly ugly
 name)
 and ran it. On trying to create a project, the first question after
 specifying
 a project folder was:

 Please enter a fully-qualified namespace
 [                                     ]

 huh? This is hardly the kind of thing that's conducive to playing
 about happily
 discovering functional programming. Can I have multiple prompts in
 clooj? Can
 I easily pull in clojure files. Where do I specify other jars?
 Classpath?

 There's a huge set of advantages to starting in a terminal:

 1. You can *see* the line that starts Clojure. If something's broken,
 you have
 a starting point.
 2. You can easily add jars.
 3. You can start multiple terminal windows to try different things.
 4. You can use your preferred editors, anything from notepad+ up,
 instead of
 some incomplete 'IDE' [Note: without starting a project, typing in the
 bottom
 right window executed commands with the input and output sort of
 interleaved,
 but without my input shown against user=, instead shown below it.]

 I'd suggest that having beginners to the language start off in a
 terminal typing
 into a REPL is absolutely the best possible thing. Packaging a
 jReadline would
 be smart too.

 Thanks, and I shall now go back into hibernation.
 Jonathan


 On Sep 2, 5:34 pm, Sean Corfield seancorfi...@gmail.com wrote:
 I think this is a much better on ramp for folks new to Clojure and the
 bullet list of the current Getting Started page really should be
 the next page not the first one.







 On Fri, Sep 2, 2011 at 3:13 PM, nchurch nchubr...@gmail.com wrote:
  There was some discussion about the Getting Started page last night at
  the Bay Area meetup.  I've put together an (I think) improved version
  at

 http://dev.clojure.org/display/doc/Getting+Started+for+Beginners

  Any suggestions/additions/deletions?  If this overall looks good, may
  I replace the current page at

 http://dev.clojure.org/display/doc/Getting+Started

  with this one?  I'd put the current page under other options,
  because it gives a lot of choices.

  My hope was to give a relatively clean path for beginners (who are the
  audience for Getting Started), instead of just throwing everything
  there is at them without comment.  Someone who has been around Clojure
  for a while knows that Lein is much more standard than Gradle, but to
  a reader of the current Getting Started page they look the same.

 --
 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



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

-- 
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