Re: pods?

2010-12-24 Thread Sunil S Nandihalli
what are PODS?


On Fri, Dec 24, 2010 at 9:52 AM, Seth  wrote:

> I am interested in the references to pods that are floating around the
> internet. However, when i downloaded the github master repository, i
> couldn't find pod anywhere. Of course there are 17 other branches...
> Clojures support for mutable multithreading is great if there are no
> side effects, but sometimes there have to be side effects - and i find
> myself resorting to locking. Can anyone give any reference to the code
> for pods/give any explanation?
>
> --
> 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: pods?

2010-12-24 Thread Meikel Brandmeyer
Hi,

Am 24.12.2010 um 09:44 schrieb Sunil S Nandihalli:

> what are PODS?

It's planned to be new reference type, which handles transients inside. So you 
send it functions living over transients for update. On deref the pod 
automatically converts things back into a persistent value. So updates will be 
fast, but things are transparently switched back to Clojure-style for you. Pods 
allow also for different strategies of update. At the moment transients are 
locked into one thread. But with pods this could be changed. Also – like Refs – 
you can modify several pods at the same time with a consistent snapshot. The 
pods take care of locking for you.

(Source the recent interview with Rich on infoq: 
http://www.infoq.com/interviews/hickey-clojure-protocols)

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


Re: pods?

2010-12-24 Thread Meikel Brandmeyer
Hi,

Am 24.12.2010 um 09:56 schrieb Meikel Brandmeyer:

> Am 24.12.2010 um 09:44 schrieb Sunil S Nandihalli:
> 
>> what are PODS?

And as a side note: I'm sad that people on conferences know more about pods 
than people on this list. :(

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


Re: Public mutable fields in deftype

2010-12-24 Thread nicolas.o...@gmail.com
After a few thoughts, I think this is a mistake not to allow this,
even if it his highly discouraged.

I think indeed, if you consider the data-structure usage of types and
Objects it is a very bad idea to have a mutable private field.

But some type you create are not for holding data on the long-run,
they are to implement an algorithm in a very local, encapsulated way.
Textbooks are full of imperative algorithms that needs some type of
aggregate type with mutations. Some of these algorithms are highly
useful, and difficult to parallellize or write efficiently in a purely
functional way.

In a good program with a nice functional structure, it can happen that
you want to write, inside a module, a function that implements such an
algorithm.
For this, you will need a way to temporary create and manipulate
mutable aggregate types. Copy your data in such "ugly" data-types, and
execute the imperative algorithm.

What can you currently do?
 -  Use a protocol per object/type, called with the same name with a y
at the end and implement set/get for each mutable part of the
aggregate. This is (very) slightly inefficient and quite ugly: double
the length of the code, hide its meaning, and, worst, it pretends to
have something general (a protocol) where you will only have one
implantation. (The protocol is tailored to mirror the type you
created.)
- Use atoms inside a immutable type. It is a bit less efficient but
slightly less ugly. Anyway, it still makes the code less
straightforward to read.
- Write a java file. It is very annoying for future portability and it
does not seem like a long-term solution.

As an illustration of my point, you can have a look at the n-body
implantation for the shootout:
http://shootout.alioth.debian.org/u32q/program.php?test=nbody&lang=clojure&id=2
Half the file is full of trivial, non reusable, interface definitions
and implementation.

My idea is that, if we were to write a program with planets, we would
write something nice, using Clojure immutable data-types and
references, and agent, and the like. And the deftype for a Body in the
shootout, wouldn't be very suitable.

But if somewhere in this big-program, we want to write a function that
compute the solution of a n-body problem, we won't have the choice, we
would need to copy the objects in ugly but efficient data-structures
and implement the fast algorithm.

Nobody would advocate that it's not the thing to do for Matrix
computations, and the array family of functions is here for that.
Why favours linear algebra algorithms (first class, can be efficiently
written in straightforward Clojure) with respect to other imperative
algorithm?

I am sure people would use such an option wisely, if it has a
sufficiently worrying name.

Sorry for the long explanation, I hope it made my point clearer.

Best regards,

Nicolas.

-- 
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: pods?

2010-12-24 Thread Sunil S Nandihalli
thanks Meikel. So really nice things are in the pipeline for clojure .. :)

On Fri, Dec 24, 2010 at 2:50 PM, Meikel Brandmeyer  wrote:

> Hi,
>
> Am 24.12.2010 um 09:56 schrieb Meikel Brandmeyer:
>
> > Am 24.12.2010 um 09:44 schrieb Sunil S Nandihalli:
> >
> >> what are PODS?
>
> And as a side note: I'm sad that people on conferences know more about pods
> than people on this list. :(
>
> 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

leiningen run

2010-12-24 Thread Marek Kubica
Hi,

Yesterday I started using leiningen and saw that it can run my
programs. So I converted my project layout so that leinigen can use
that.

My project is currently quite simple. The program needs a single
argument, filename, to read from. So I added a :main entry into
project.clj and started

$ lein run

this took some time and crashed with an exception, because I did not
specify a file. Well, that was to be expected. So I thought I just add
an argument:

$ lein run filename

Instead of the output, I got this stacktrace:

Exception in thread "main" java.lang.Exception: Unable to resolve
symbol: filename in this context (NO_SOURCE_FILE:1)
at clojure.lang.Compiler.analyze(Compiler.java:5205)
at clojure.lang.Compiler.analyze(Compiler.java:5151) 
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3057)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5371)
at clojure.lang.Compiler.analyze(Compiler.java:5190)
at clojure.lang.Compiler.analyze(Compiler.java:5151)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:4670)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4328)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3173)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5367)
at clojure.lang.Compiler.analyze(Compiler.java:5190)
at clojure.lang.Compiler.eval(Compiler.java:5421)
at clojure.lang.Compiler.eval(Compiler.java:5415)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$null_opt.invoke(main.clj:279)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:422)
at clojure.lang.Var.invoke(Var.java:369)
at clojure.lang.AFn.applyToHelper(AFn.java:165)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.lang.Exception: Unable to resolve symbol: filename in
this context
at clojure.lang.Compiler.resolveIn(Compiler.java:5677)
at clojure.lang.Compiler.resolve(Compiler.java:5621)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:5584)
at clojure.lang.Compiler.analyze(Compiler.java:5172)
... 23 more

Any ideas what I'm doing wrong? It seems to try to evaluate the
arguments as symbols, but for what purpose? I need a string...

regards,
Marek

-- 
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: leiningen run

2010-12-24 Thread Alex Osborne
Marek Kubica  writes:

> My project is currently quite simple. The program needs a single
> argument, filename, to read from. So I added a :main entry into
> project.clj and started
>
> $ lein run
>
> this took some time and crashed with an exception, because I did not
> specify a file. Well, that was to be expected. So I thought I just add
> an argument:
>
> $ lein run filename
>
> Instead of the output, I got this stacktrace:
>
> Exception in thread "main" java.lang.Exception: Unable to resolve
> symbol: filename in this context (NO_SOURCE_FILE:1)

I think this is a bug.  I've sent Phil a pull request with a proposed
fix:

http://github.com/ato/leiningen/commit/3f299cc560dbf7101c44a08d98da4177d6f326cc

In the meantime you should be able to work around it by using:

$ lein run -m your.namespace filename

Or alternatively quoting the first argument like this:

$ lein run '"filename"'

-- 
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: leiningen run

2010-12-24 Thread Marek Kubica
On Fri, 24 Dec 2010 23:54:30 +1100
Alex Osborne  wrote:

> I think this is a bug.  I've sent Phil a pull request with a proposed
> fix:
> 
> http://github.com/ato/leiningen/commit/3f299cc560dbf7101c44a08d98da4177d6f326cc

Yep, bendlas in #clojure helped me to diagnose. Great that you have a
fix already, thanks!

> In the meantime you should be able to work around it by using:
> 
> $ lein run -m your.namespace filename

Yes, that works.

> Or alternatively quoting the first argument like this:
> 
> $ lein run '"filename"'

Good to know, that looks a bit "nicer" than repeating what is defined
in project.clj already.

Thanks a lot, hope the bugfix will get pulled soon :)

regards,
Marek

-- 
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: Let's see how fast we can make this

2010-12-24 Thread David Nolen
On Fri, Dec 24, 2010 at 2:55 AM, Alan Busby  wrote:

> Hi All,
>
>
> On Fri, Dec 24, 2010 at 4:32 PM, Meikel Brandmeyer  wrote:
>
>  Most interesting is also the relation between the different versions on
>> the given machine. Just the numbers of one algorithm aren't really
>> comparable, I guess. (different machine, different load, different phase of
>> moon, who knows...)
>>
>
> Did the below just for my own amusement on a 64bit linux box, and thought
> it might be interesting to others. The fastest implementation was using
> areduce with 1.3.0-alpha and unchecked ops for 2800ns. Unoptimized C was
> doing 700ns though, and with -O2 it was 400ns. Reminds me why JNI can be so
> valuable sometimes.
>

In order to be fair you probably need to remember to switch your C
arithmetic operations to 64bit longs.

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: Let's see how fast we can make this

2010-12-24 Thread Devrim Baris Acar
I guess it would be a better guess if you could includethe cpu type/speed
for a rough reference...

Devrim Baris Acar



On Fri, Dec 24, 2010 at 09:55, Alan Busby  wrote:

> Hi All,
>
>
> On Fri, Dec 24, 2010 at 4:32 PM, Meikel Brandmeyer  wrote:
>
>  Most interesting is also the relation between the different versions on
>> the given machine. Just the numbers of one algorithm aren't really
>> comparable, I guess. (different machine, different load, different phase of
>> moon, who knows...)
>>
>
> Did the below just for my own amusement on a 64bit linux box, and thought
> it might be interesting to others. The fastest implementation was using
> areduce with 1.3.0-alpha and unchecked ops for 2800ns. Unoptimized C was
> doing 700ns though, and with -O2 it was 400ns. Reminds me why JNI can be so
> valuable sometimes.
>
>
> /* -O0 low of 700ns
> -02 low of 400ns */
> int char_count(char* ptr)
> {
>   int count = 0;
>   int i;
>
>   for(i=0; ptr[i]; ptr++)
> if(ptr[i]!=32)
>   count++;
>
>   return count;
> }
>
>
> ;; 1.2.0 low of 65000ns
>
>
>
> ;; 1.3.0-alpha3 low of 46000ns
>
>
>
> ;;
>
>
>
> (defn count-num-chars-v1 [^String s]
>   (loop [s s acc 0]
> (if (seq s)
>   (recur (rest s) (if (= (first s) \space) acc (inc acc)))
>   acc)))
>
>
> ;; 1.2.0 low of 6200ns
>
>
>
> ;; 1.3.0-alpha3 low of 4800ns
>
>
>
> ;;
>
>
>
> (defn count-num-chars-v2 [^String s]
>   (let [len (.length s)
> space (int 32)]
> (loop [i (int 0), c (int 0)]
>   (if (< i len)
> (recur
>   (inc i)
>  (if (== (.codePointAt s i) space)
>c
>(unchecked-inc c)))
>c
>
>
> ;; 1.2.0 low of 12500ns
>
>
>
> ;; 1.3.0-alpha3 low of 4450ns
>
>
>
> ;; 1.3.0-alpha3 with *unchecked-math* enabled low of 2800ns
>
>
>
> ;;
>
>
>
> (defn count-num-chars-v3 [^String s]
>   (let [as (.toCharArray s)]
>(areduce as idx acc 0 (if (= (int (aget as idx)) (int \space)) acc
> (inc acc)
>
>
> ;; 1.2.0 untested
>
>
>
> ;; 1.3.0-alpha3 low of 4500ns
>
>
>
> ;;
>
>
>
> (defn count-num-chars-v4 ^long [^String s]
>   (let [l (.length s)
> c \space]
> (loop [i 0 acc 0]
>   (if (< i l)
> (recur (inc i)
>(if (identical? (.charAt s i) c) acc
>(inc acc)))
> acc
>
>
> Hope this helps,
> Alan
>
> --
> 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: pods?

2010-12-24 Thread Seth

> It's planned to be new reference type, which handles transients inside. So 
> you send it functions living over transients for update. On deref the pod 
> automatically converts things back into a persistent value. So updates will 
> be fast, but things are transparently switched back to Clojure-style for you. 
> Pods allow also for different strategies of update. At the moment transients 
> are locked into one thread. But with pods this could be changed. Also – like 
> Refs – you can modify several pods at the same time with a consistent 
> snapshot. The pods take care of locking for you.


Is there any code for it yet?

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


websockets w/ clojure

2010-12-24 Thread Sean Allen
We did a prototype application using websockets for work using node.js as
the server.
Websocket client connects, sending some basic info... said info is used to
repeatedly get
new data from a database that is pushed down as it arrives in the db to the
client which displays.
There will be more than 1 client, each with its own data constraints that
are used to get the data
to send.

If it goes into production we need to run on the jvm so I've been rewriting
in clojure. I spent a couple
hours yesterday trying to figuring out the best websockets option to use w/
the clojure based server
before I gave up. I realized w/o any background I'm just running blind.

Given the basic idea of the application, what is the best websockets
abstraction to use w/ clojure?
Aleph? The jetty websocket support? Something else?

Pointers from anyone will more experience doing a websocket server in
clojure greatly appreciated.

Thanks,
Sean

-- 
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: websockets w/ clojure

2010-12-24 Thread paul santa clara
I have had a lot of success with Aleph.  Just remember to clone the git repo
as things move quickly and the clojars version is often out of date.  Also,
I would recommend taking the time to read over lamina wiki's as Aleph
utilizes their channel abstractions:
https://github.com/ztellman/lamina/wiki/Channels

And of course: https://github.com/ztellman/aleph/wiki/HTTP

good luck,
-Paul SC


On Fri, Dec 24, 2010 at 11:58 AM, Sean Allen wrote:

> We did a prototype application using websockets for work using node.js as
> the server.
> Websocket client connects, sending some basic info... said info is used to
> repeatedly get
> new data from a database that is pushed down as it arrives in the db to the
> client which displays.
> There will be more than 1 client, each with its own data constraints that
> are used to get the data
> to send.
>
> If it goes into production we need to run on the jvm so I've been rewriting
> in clojure. I spent a couple
> hours yesterday trying to figuring out the best websockets option to use w/
> the clojure based server
> before I gave up. I realized w/o any background I'm just running blind.
>
> Given the basic idea of the application, what is the best websockets
> abstraction to use w/ clojure?
> Aleph? The jetty websocket support? Something else?
>
> Pointers from anyone will more experience doing a websocket server in
> clojure greatly appreciated.
>
> Thanks,
> Sean
>
> --
> 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: into map with vectors versus lists (Re: Creating map from string)

2010-12-24 Thread Emeka
Did you try this

(apply hash-map (partition 2 (split (slurp "data") #",")))



On Sat, Dec 4, 2010 at 11:12 AM, Remco van 't Veer wrote:

> I expected this to work:
>
>  (into {} (partition 2 (split (slurp "data") #",")))
>
> But unfortunately, `into' doesn't seem to allow pushing lists of pairs
> into a map.  But vectors are allowed:
>
>  (into {} (map vec (partition 2 (split (slurp "data") #","
>
> Can somebody explain why vectors are allowed and lists not?
>
>
> On 2010/12/03 15:40, Laurent PETIT wrote:
>
> > Hi,
> >
> > 2010/12/3 Anclj 
> >
> > Hi,
> >
> > I have a string of data and I would like to get a map {:key
> > value, :key value, …}
> >
> > How could I do that?
> >
> > I've got:
> >
> > user> (split (slurp "data") #",")
> > ["0" "2" "1" "5" "2" "8" "3" "15" "4" "9"]
> >
> > And I would like:
> > {:0 2, :1 5, :2 8, :3 15, :4 9}
> >
> > Any idea?
> >
> > (let [s (split (slurp "data") #",")]
> >   (zipmap (take-nth 2 s) (take-nth 2 (rest s
> >
> > HTH,
> >
> > --
> > Laurent
> >
> > --
> > 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




-- 
*Satajanus  Nig. Ltd


*

-- 
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: pods?

2010-12-24 Thread Michael Ossareh
On Fri, Dec 24, 2010 at 01:20, Meikel Brandmeyer  wrote:

> Hi,
>
> Am 24.12.2010 um 09:56 schrieb Meikel Brandmeyer:
>
> > Am 24.12.2010 um 09:44 schrieb Sunil S Nandihalli:
> >
> >> what are PODS?
>
> And as a side note: I'm sad that people on conferences know more about pods
> than people on this list. :(
>

Is there a go to place for a roadmap? http://dev.clojure.org/ perhaps?


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

Re: pods?

2010-12-24 Thread Alex Osborne
Michael Ossareh  writes:

> Is there a go to place for a roadmap? http://dev.clojure.org/ perhaps?

There's no roadmap as such, Clojure development is not
calendar-oriented. ;-)  Last December when people started asking this
question Rich said:

I don't like to publish roadmaps, as often the best features in any
particular year wouldn't have been on the roadmap for that year.

But yes the "Clojure Design" part of the wiki is usually the place to
look for notes and ideas about upcoming changes and additions.  Remember
what's there is work in progress design notes, there's no guarantee that
anything there will be adopted in that form or even at all.

There is a placeholder page about pods.

http://dev.clojure.org/display/design/Mutex+references+(pods,+nee+cells)

And the assembla wiki (the predecessor to dev.clojure.org) has a page on
their earlier incarnation as cells.

http://www.assembla.com/wiki/show/clojure/Cells

They've also been discussed a lot in the #clojure IRC channel on
Freenode.

-- 
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: websockets w/ clojure

2010-12-24 Thread Zach Tellman
If you decide to try Aleph and have any questions, I'm available via
Github or on the mailing list at http://groups.google.com/group/aleph-lib.

Zach

On Dec 24, 10:55 am, paul santa clara  wrote:
> I have had a lot of success with Aleph.  Just remember to clone the git repo
> as things move quickly and the clojars version is often out of date.  Also,
> I would recommend taking the time to read over lamina wiki's as Aleph
> utilizes their channel 
> abstractions:https://github.com/ztellman/lamina/wiki/Channels
>
> And of course:https://github.com/ztellman/aleph/wiki/HTTP
>
> good luck,
> -Paul SC
>
> On Fri, Dec 24, 2010 at 11:58 AM, Sean Allen 
> wrote:
>
>
>
>
>
>
>
> > We did a prototype application using websockets for work using node.js as
> > the server.
> > Websocket client connects, sending some basic info... said info is used to
> > repeatedly get
> > new data from a database that is pushed down as it arrives in the db to the
> > client which displays.
> > There will be more than 1 client, each with its own data constraints that
> > are used to get the data
> > to send.
>
> > If it goes into production we need to run on the jvm so I've been rewriting
> > in clojure. I spent a couple
> > hours yesterday trying to figuring out the best websockets option to use w/
> > the clojure based server
> > before I gave up. I realized w/o any background I'm just running blind.
>
> > Given the basic idea of the application, what is the best websockets
> > abstraction to use w/ clojure?
> > Aleph? The jetty websocket support? Something else?
>
> > Pointers from anyone will more experience doing a websocket server in
> > clojure greatly appreciated.
>
> > Thanks,
> > Sean
>
> > --
> > 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: websockets w/ clojure

2010-12-24 Thread Jay Fields
I've written a few Clojure websocket apps and used Jetty. Things worked out 
fine and there wasn't much code at all to integrate. I'd recommend it. 

Sent from my iPhone

On Dec 24, 2010, at 11:58 AM, Sean Allen  wrote:

> We did a prototype application using websockets for work using node.js as the 
> server.
> Websocket client connects, sending some basic info... said info is used to 
> repeatedly get
> new data from a database that is pushed down as it arrives in the db to the 
> client which displays.
> There will be more than 1 client, each with its own data constraints that are 
> used to get the data 
> to send.
> 
> If it goes into production we need to run on the jvm so I've been rewriting 
> in clojure. I spent a couple
> hours yesterday trying to figuring out the best websockets option to use w/ 
> the clojure based server
> before I gave up. I realized w/o any background I'm just running blind.
> 
> Given the basic idea of the application, what is the best websockets 
> abstraction to use w/ clojure?
> Aleph? The jetty websocket support? Something else? 
> 
> Pointers from anyone will more experience doing a websocket server in clojure 
> greatly appreciated.
> 
> Thanks,
> Sean
> -- 
> 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: Let's see how fast we can make this

2010-12-24 Thread Alan Busby
On Fri, Dec 24, 2010 at 7:10 PM, Devrim Baris Acar wrote:

> I guess it would be a better guess if you could includethe cpu type/speed
> for a rough reference...


It was on an Intel Xeon E5410 (2.33GHz), though like others have already
said there are a number of factors that affect performance. I was simply
curious of the relative speeds of the various code snippets on a production
server.

Also, I tried the C version using unsigned long long ints (64bit) and it was
roughly the same speed.

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

partitioning iterative list

2010-12-24 Thread Glen Rubin
Can I do the following without using loops??

I have list, e.g.

'(4 6 66 33 26 6 83 5)

I want to partition it so that I get a subset of lists that build up
to the original:

( (4) (4 6) (4 6 66) (4 6 66 33) )

-- 
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: partitioning iterative list

2010-12-24 Thread Alex Osborne
Glen Rubin  writes:

> Can I do the following without using loops??
>
> I have list, e.g.
>
> '(4 6 66 33 26 6 83 5)
>
> I want to partition it so that I get a subset of lists that build up
> to the original:
>
> ( (4) (4 6) (4 6 66) (4 6 66 33) )

(reductions conj [] [4 6 66 33 26 6 83 5])
=> ([] [4] [4 6] [4 6 66] [4 6 66 33] [4 6 66 33 26] ...)

-- 
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: Let's see how fast we can make this

2010-12-24 Thread David Nolen
On Fri, Dec 24, 2010 at 7:32 PM, Alan Busby  wrote:

> On Fri, Dec 24, 2010 at 7:10 PM, Devrim Baris Acar 
> wrote:
>
>> I guess it would be a better guess if you could includethe cpu type/speed
>> for a rough reference...
>
>
> It was on an Intel Xeon E5410 (2.33GHz), though like others have already
> said there are a number of factors that affect performance. I was simply
> curious of the relative speeds of the various code snippets on a production
> server.
>
> Also, I tried the C version using unsigned long long ints (64bit) and it
> was roughly the same speed.
>

On OS X at least the following program shows identical performance to the
JVM using 64 bit integers, ~2000 nanoseconds on my machine. So Clojure is
not too far behind.

#import 
#include "stdio.h"

long long count_chars(const char* s) {
  long long count = 0;
  long long i;
  for(i=0; s[i]; s++) {
if(s[i] != 32) {
  count++;
}
  }
  return count;
}

int main(int argc, char** argv) {
  const char *s = "This is a really long stringThis is a really long
stringThis is a really long stringThis is a really long stringThis is a
really long stringThis is a really long stringThis is a really long
stringThis is a really long stringThis is a really long stringThis is a
really long stringThis is a really long stringThis is a really long
stringThis is a really long stringThis is a really long stringThis is a
really long stringThis is a really long stringThis is a really long
stringThis is a really long stringThis is a really long stringThis is a
really long string";
  long long i;
  long long j;

  for(j = 0; j < 10; j++) {
uint64_t start = mach_absolute_time();
for(i = 0; i < 1000; i++) {
  count_chars(s);
}
uint64_t end = mach_absolute_time();
printf("%Lf nanoseconds\n", ((long double) end-start) / 1000.0);
  }

  exit(0);
}


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: Let's see how fast we can make this

2010-12-24 Thread David Nolen
On Fri, Dec 24, 2010 at 8:19 PM, David Nolen  wrote:

> On OS X at least the following program shows identical performance to the
> JVM using 64 bit integers, ~2000 nanoseconds on my machine. So Clojure is
> not too far behind.
>

w/o any GCC optimizations of course. With O2, the C is twice as fast on this
particularly micro microbenchmark.

In anycase, Clojure is no slouch :)

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: Let's see how fast we can make this

2010-12-24 Thread Alan Busby
On Sat, Dec 25, 2010 at 11:28 AM, David Nolen wrote:

> On Fri, Dec 24, 2010 at 8:19 PM, David Nolen wrote:
>
>> On OS X at least the following program shows identical performance to the
>> JVM using 64 bit integers, ~2000 nanoseconds on my machine. So Clojure is
>> not too far behind.
>>
>
> w/o any GCC optimizations of course. With O2, the C is twice as fast on
> this particularly micro microbenchmark.
>

On my "newish" Macbook I compiled and tested your code.
I changed the thousand loop to a million loop and your code went from
~1000ns to ~600ns w/ O2 optimization.



> In anycase, Clojure is no slouch :)
>

I agree 100%, but I've been surprised to find such significant performance
improvements in my own code by incorporating JNI for certain hot spots.

-- 
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: Let's see how fast we can make this

2010-12-24 Thread Michael Gardner
On Dec 24, 2010, at 8:19 PM, David Nolen wrote:

> ((long double) end-start) / 1000.0

I don't think this math is correct. The units for the values returned by 
mach_absolute_time() are CPU-dependent: 
http://developer.apple.com/library/mac/#qa/qa2004/qa1398.html

Using gettimeofday() on my 2.0 GHz Core 2 Duo Macbook, I get minima of ~3400 
microseconds for unoptimized C, ~800 microseconds for -O2.

#include 
#include 

unsigned count_chars(char const * s) {
unsigned count = 0;
while (*s++)
if (*s != ' ')
++count;
return count;
}

int main(int argc, char** argv) {
char const * s = "This is a really long stringThis is a really long 
stringThis is a really long stringThis is a really long stringThis is a really 
long stringThis is a really long stringThis is a really long stringThis is a 
really long stringThis is a really long stringThis is a really long stringThis 
is a really long stringThis is a really long stringThis is a really long 
stringThis is a really long stringThis is a really long stringThis is a really 
long stringThis is a really long stringThis is a really long stringThis is a 
really long stringThis is a really long string";
unsigned i, j;
struct timeval start, end;

for (j = 0; j < 10; ++j) {
gettimeofday(&start, 0);
for (i = 0; i < 1000; ++i)
count_chars(s);
gettimeofday(&end, 0);
printf("%u us\n", (unsigned)(100 * (end.tv_sec - start.tv_sec) + 
(end.tv_usec - start.tv_usec)));
}

return(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: leiningen run

2010-12-24 Thread Phil Hagelberg
On Dec 24, 5:06 am, Marek Kubica  wrote:
> Thanks a lot, hope the bugfix will get pulled soon :)

Just merged it in; thanks for reporting.

-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: websockets w/ clojure

2010-12-24 Thread Sean Allen
Jay,

Do you have any publicly released code I could take a look at?
I've only found a couple of jetty/clojure/websocket examples and would love
to have more I could study.

-Sean-

On Fri, Dec 24, 2010 at 7:53 PM, Jay Fields  wrote:

> I've written a few Clojure websocket apps and used Jetty. Things worked out
> fine and there wasn't much code at all to integrate. I'd recommend it.
>
> Sent from my iPhone
>
> On Dec 24, 2010, at 11:58 AM, Sean Allen 
> wrote:
>
> We did a prototype application using websockets for work using node.js as
> the server.
> Websocket client connects, sending some basic info... said info is used to
> repeatedly get
> new data from a database that is pushed down as it arrives in the db to the
> client which displays.
> There will be more than 1 client, each with its own data constraints that
> are used to get the data
> to send.
>
> If it goes into production we need to run on the jvm so I've been rewriting
> in clojure. I spent a couple
> hours yesterday trying to figuring out the best websockets option to use w/
> the clojure based server
> before I gave up. I realized w/o any background I'm just running blind.
>
> Given the basic idea of the application, what is the best websockets
> abstraction to use w/ clojure?
> Aleph? The jetty websocket support? Something else?
>
> Pointers from anyone will more experience doing a websocket server in
> clojure greatly appreciated.
>
> Thanks,
> Sean
>
> --
> 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