Re: Using the Clojure Logo

2012-03-29 Thread Marco Dalla Stella
Il 26 marzo 2012 16:33, Marco Dalla Stella m.dallaste...@gmail.com ha scritto: Hi, We would like to use the Clojure logo for our new Italian Clojure User Group. Thank you all for your kind answer. We are not going to use any logo until Rich will give us his permission. It will be great if

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-29 Thread Greg Chapman
On Mar 22, 10:18 pm, Andy Fingerhut andy.finger...@gmail.com wrote: If anyone has suggestions for what you would like to see added to the cheatsheet, especially _specific_ suggestions, feel free to send me email. I was just looking at the clojure.org cheatsheet today and noticed that it

Re: Cheap way to find function (defn) name using a macro?

2012-03-29 Thread Sun Ning
Since you want to use the plain defn, what about thinking in a different way ? Write a macro like `with-function-name`, wraps the function call instead of the function definition. (defmacro with-function-name [fn-name args] ...) In clojure, because you can assign function to a var at any

Re: Newbie's Guide to Learning Clojure

2012-03-29 Thread George Oliver
On Mar 28, 10:16 am, Elango Cheran elango.che...@gmail.com wrote: Hi everyone, On Gregg's suggestion, I want to share a writeup about how total beginners can learn Clojure in a minimally painful way.  I'd welcome any comments, suggestions, etc. You could add a link to this guide,

What's the efficient functional way to computing the average of a sequence of numbers?

2012-03-29 Thread simon.T
The obvious way is like the following, which traverse the sequence 2 times. Wondering what will be the efficient way... (defn avg [coll] (/ (reduce + coll) (count coll))) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Clojure-Specific Emacs Environment

2012-03-29 Thread ian.tegebo
tl;dr Is anyone working on a Clojure-Specific Emacs Environment? If considered but dismissed, then why? I've just reviewed a thread about nREPL. The thread also (somewhat indirectly) calls into question the current practice of piggy-backing on SLIME: About a networked REPL...

Re: What's the efficient functional way to computing the average of a sequence of numbers?

2012-03-29 Thread Linus Ericsson
or to increase a counter while reducing it, a function like inc+ returning {:sum sum :count count} and then take the sum/counter, which is the mean. The problem is possible to state as a clean map-reduce problem with only one traversing of the data. It's also possible to remove items form the

SubVec anomaly

2012-03-29 Thread stirfoo
user= (nth (subvec [:??? 1 2] 1) -1) :??? This could be a bug, not sure. Only the upper bound of the internal SubVec is being checked. -- 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

Re: What's the efficient functional way to computing the average of a sequence of numbers?

2012-03-29 Thread Rick Beerendonk
The obvious way is like the following, which traverse the sequence 2 times. Wondering what will be the efficient way... (defn avg [coll] (loop [c coll tot 0 cnt 0] (if (empty? c) (/ tot cnt) (recur (rest c) (+ tot (first c)) (inc cnt) This will loop only once. It happens

Re: What's the efficient functional way to computing the average of a sequence of numbers?

2012-03-29 Thread Rob Nagle
You can reduce in one pass with a function that tracks both the sum and the count. (defn avg [coll] (apply / (reduce (fn [[sum n] x] [(+ sum x) (inc n)]) [0 0] coll))) This reduce function is somewhat unusual in that its arguments have different forms. As a result, this one does require the

Re: can Clojure 1.3 code always be made as fast as Java for numeric computations?

2012-03-29 Thread Jay Fields
It wasn't very complicated, I just started from zero experience worrying about this stuff. - switch map to loop+recur - add primitive type hints to args and return values - make sure you get the types right (e.g. make sure your longs are longs, not ints) Cheers, Jay On Mar 28, 2012, at 10:17

Using JPPF in Clojure - Class Loading Issues

2012-03-29 Thread Gunnar Völkel
JPPF is a Java framework to perform distributed execution of computation jobs. In my experiment to use JPPF (http://www.jppf.org) in Clojure I noticed a class loading problem. A JPPFTask implemenation created via 'proxy could not be loaded by the JPPF framework. As a result I got the following

Re: SubVec anomaly

2012-03-29 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 5:15 AM, stirfoo stir...@gmail.com wrote: user= (nth (subvec [:??? 1 2] 1) -1) :??? This could be a bug, not sure. Only the upper bound of the internal SubVec is being checked. Hmm. This also raises the specter of (let [a

Re: Cheap way to find function (defn) name using a macro?

2012-03-29 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 11:48 PM, Shantanu Kumar kumar.shant...@gmail.com wrote: If you control the third line of: (defn foo [x y]   (let [z (bar y (next x))]     (println Done in (find-name) .)     (* 4 z (count x then don't you control the first? Cedric – Unfortunately, no. The

Re: SubVec anomaly

2012-03-29 Thread Andy Fingerhut
Thanks for the catch. Bug report with patch created: http://dev.clojure.org/jira/browse/CLJ-962 Andy On Mar 29, 2012, at 2:15 AM, stirfoo wrote: user= (nth (subvec [:??? 1 2] 1) -1) :??? This could be a bug, not sure. Only the upper bound of the internal SubVec is being checked.

Re: Cheap way to find function (defn) name using a macro?

2012-03-29 Thread Shantanu Kumar
On Mar 29, 5:50 pm, Cedric Greevey cgree...@gmail.com wrote: On Wed, Mar 28, 2012 at 11:48 PM, Shantanu Kumar kumar.shant...@gmail.com wrote: If you control the third line of: (defn foo [x y]   (let [z (bar y (next x))]     (println Done in (find-name) .)     (* 4 z (count x

Source code as metadata

2012-03-29 Thread Petr Gladkikh
I am pondering on the idea of having more (or even a lot) of metadata that could be useful for debugging and problem resolution. Since we can store anything in metadata, can we store not only source file path and line number but whole source code that is associated with piece of code? For

Re: Source code as metadata

2012-03-29 Thread Phil Hagelberg
On Thu, Mar 29, 2012 at 9:29 AM, Petr Gladkikh petrg...@gmail.com wrote: I am pondering on the idea of having more (or even a lot) of metadata that could be useful for debugging and problem resolution. Since we can store anything in metadata, can we store not only  source file path and line

Re: Clojure-Specific Emacs Environment

2012-03-29 Thread Phil Hagelberg
On Thu, Mar 29, 2012 at 12:48 AM, ian.tegebo ian.teg...@gmail.com wrote: Is anyone working on a Clojure-Specific Emacs Environment?  If considered but dismissed, then why? The problem is that swank-clojure+slime offers a local maximum. While there are difficulties working with CL and Clojure at

Re: Using the Clojure Logo

2012-03-29 Thread Daniel Gagnon
First of all, one only has to police unauthorized use of the trademark. One can authorize its use under particular circumstances, and then those uses don't need to be policed to avoid losing the trademark. That's at the heart of trademark law. A trademark is a form of Proof of origin. If

Re: Using the Clojure Logo

2012-03-29 Thread Stuart Sierra
Please let's not get into a discussion of Copyright or Trademark law. As far as I know the Clojure logo is not currently trademarked. Rich's request is that people not use the logo for purposes other than to represent the Clojure language. -S -- You received this message because you are

Re: Clojure Toolbox

2012-03-29 Thread Qihui Sun
Thank you all! 谢谢! 2012/3/25 dennis zhuang killme2...@gmail.com Another link http://cnlojure.org/open.html 2012/3/24 Rostislav Svoboda rostislav.svob...@gmail.com A nice list of tools and libraries I stumbled upon. Enjoy! http://www.clojure-toolbox.com/ -- You received this message

Alternative download site for Clojure 1.3?

2012-03-29 Thread Chris Webster
I'm hoping to start learning Clojure (via The Joy Of Clojure book), but I'm having trouble downloading Clojure 1.3 from the http://clojure.org/downloads site. It downloads maybe 50 or 100 MB very slowly, then grinds to a halt saying the download was interrupted (on Google Chrome browser).

Re: Alternative download site for Clojure 1.3?

2012-03-29 Thread Stuart Sierra
There must be something strange going on. The Clojure 1.3 ZIP file is only 4.5 MB. The Clojure distribution is published through the public Maven repository system, which has many mirrors: http://docs.codehaus.org/display/MAVENUSER/Mirrors+Repositories For example, here's one mirror of Clojure

Re: Using the Clojure Logo

2012-03-29 Thread Daniel Gagnon
As far as I know the Clojure logo is not currently trademarked. You can have a trademark without registering anything (registration is somewhere between $200 and $300 in the US, I forgot the exact amount), it's just harder to demonstrate without a registration than copyright. -- You received

Re: What's the efficient functional way to computing the average of a sequence of numbers?

2012-03-29 Thread David Cabana
On Thu, Mar 29, 2012 at 12:18 AM, simon.T simon.j@gmail.com wrote: The obvious way is like the following, which traverse the sequence 2 times. ... The obvious way does not necessarily traverse the sequence twice. If a sequence S satisfies the 'counted?' predicate, (count S) takes constant

Re: Cheap way to find function (defn) name using a macro?

2012-03-29 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 11:35 AM, Shantanu Kumar kumar.shant...@gmail.com wrote: On Mar 29, 5:50 pm, Cedric Greevey cgree...@gmail.com wrote: On Wed, Mar 28, 2012 at 11:48 PM, Shantanu Kumar kumar.shant...@gmail.com wrote: If you control the third line of: (defn foo [x y]   (let [z

Re: Using the Clojure Logo

2012-03-29 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 1:07 PM, Daniel Gagnon redalas...@gmail.com wrote: First of all, one only has to police unauthorized use of the trademark. One can authorize its use under particular circumstances, and then those uses don't need to be policed to avoid losing the trademark. That's at

Re: Using the Clojure Logo

2012-03-29 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 1:10 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: Rich's request is that people not use the logo for purposes other than to represent the Clojure language. How does he define represent the Clojure language? Just that its use, in a particular instance, is to refer

The rationale behind mutable namespaces?

2012-03-29 Thread Alf Kristian Støyle
Hi guys. First off, love Clojure and it has been a hobby of mine for several years. When first learning Clojure, one thing I didn't like, was the ability to actually change a Var at any point in time. Either through several def/defn's pointing to the same namespace/symbol or by something like

Re: Cheap way to find function (defn) name using a macro?

2012-03-29 Thread Shantanu Kumar
81  (defn foo [...] 82    (let [x (compute-something ...)] 83      (do-something x ...) 84      (calculate-whatever ...))) and you're able to edit lines 82, 83, and 84 but not line 81 (or whatever). But I can't see any plausible circumstance where that would be the case. That's exactly

Re: Cheap way to find function (defn) name using a macro?

2012-03-29 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 2:36 PM, Shantanu Kumar kumar.shant...@gmail.com wrote: 81  (defn foo [...] 82    (let [x (compute-something ...)] 83      (do-something x ...) 84      (calculate-whatever ...))) and you're able to edit lines 82, 83, and 84 but not line 81 (or whatever). But I can't

Re: Alternative download site for Clojure 1.3?

2012-03-29 Thread Sean Corfield
On Thu, Mar 29, 2012 at 6:41 AM, Chris Webster cmhwebs...@gmail.com wrote: Is there an alternative/mirror site for downloading Clojure, or do I just have to wait until the main site is working again? You might want to start with Leiningen since that will hide all of the classpath / dependency

Re: The rationale behind mutable namespaces?

2012-03-29 Thread Herwig Hochleitner
2012/3/29 Alf Kristian Støyle alf.krist...@gmail.com: So, long story short, why are namespaces in Clojure mutable? What is the rationale behind this? It's for REPL development. Everytime you redefine a function, its Var needs to be updated. OTOH, redefining a var during the normal course of

partition-distinct

2012-03-29 Thread David Jagoe
Hi all, I'm sure I'm missing a really simple way of doing this! Given a sequence like this: [1 2 1 2 1 1 2 1 2 2 2] partition it to get this: [(1 2) (1 2) (1) (1 2) (1 2) (2) (2)] I've been trying to write something generic like partition-by because the values are maps. Also I want to be able

Re: partition-distinct

2012-03-29 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 4:18 PM, David Jagoe davidja...@gmail.com wrote: Hi all, I'm sure I'm missing a really simple way of doing this! Given a sequence like this: [1 2 1 2 1 1 2 1 2 2 2] partition it to get this: [(1 2) (1 2) (1) (1 2) (1 2) (2) (2)] I've been trying to write something

Re: Using the Clojure Logo

2012-03-29 Thread Donald Lindsay
Considering what I've seen of other lisp logos, I'd 'polly want to see a preview. It's Lisp, the 3 -rlt entiti cassius ~/dev/null On Wednesday, March 28, 2012, Dimitrios wrote: On 28/03/12 13:12, Stuart Sierra wrote: Rich Hickey holds the copyright on the Clojure logo design, and it's not

Re: partition-distinct

2012-03-29 Thread Weber, Martin S
Yeah I don't like that either. Consider (comp vals (partial group-by identity)). On 2012-03-29 16:18 , David Jagoe davidja...@gmail.com wrote: Hi all, I'm sure I'm missing a really simple way of doing this! Given a sequence like this: [1 2 1 2 1 1 2 1 2 2 2] partition it to get this: [(1 2) (1

Re: What's the efficient functional way to computing the average of a sequence of numbers?

2012-03-29 Thread Alan Malloy
On Mar 29, 10:18 am, David Cabana drcab...@gmail.com wrote: On Thu, Mar 29, 2012 at 12:18 AM, simon.T simon.j@gmail.com wrote: The obvious way is like the following, which traverse the sequence 2 times. ... The obvious way does not necessarily traverse the sequence twice.  If a

Re: partition-distinct

2012-03-29 Thread Weber, Martin S
Meh. Half-assed (mis)reading. Sorry. -Martin On 2012-03-29 16:23 , Weber, Martin S martin.we...@nist.gov wrote: Yeah I don't like that either. Consider (comp vals (partial group-by identity)). On 2012-03-29 16:18 , David Jagoe davidja...@gmail.com wrote: Hi all, I'm sure I'm missing a really

ClojureScript gets PersistentVectors

2012-03-29 Thread David Nolen
Thanks to Laszlo Török, ClojureScript now has PersistentVectors, https://github.com/clojure/clojurescript/commit/e615f4cd326e7c608050272c64c4dfaff9a34689 . They are based on the Java implementations found in Clojure. I'm happy to say they thoroughly trounce the old copy-on-write Vectors:

Drawbridge: a (Ring) HTTP transport for nREPL

2012-03-29 Thread Chas Emerick
Drawbridge is an HTTP/HTTPS nREPL transport, implemented as a Ring handler: https://github.com/cemerick/drawbridge It also provides a client-side nREPL transport using clj-http that extends nREPL's url-connect; the intention is that any tool that uses url-connect will be able to

Re: ClojureScript gets PersistentVectors

2012-03-29 Thread Evan Mezeske
This is excellent. Big thanks to Laszlo! I've been working on a Raphaël-based interactive GUI app in ClojureScript that maintains a big vector of elements, and had just recently started to run into what seemed to be the performance limits of the copy-on-write approach. I'm very optimistic

Re: What's the efficient functional way to computing the average of a sequence of numbers?

2012-03-29 Thread David Cabana
Very likely strikes me as a huge overstatement here. Most sequences that you want to average won't be source-code literals, they'll be lazy sequences, and those aren't counted Point taken about lazy sequences. But the above was not intended to suggest the sequence needs to be source code

Re: ClojureScript gets PersistentVectors

2012-03-29 Thread László Török
It has been a great learning experience on both Clojure internals and the Clojurescript side. One thing to note, that the handwritten JS (which also a straight port of the java version and not optimized by the closure compiler) still outperforms the Clojurescript version consistently by at least a

Re: Using the Clojure Logo

2012-03-29 Thread Chip Collier
On 3/29/12 12:33 AM, Marco Dalla Stella wrote: Il 26 marzo 2012 16:33, Marco Dalla Stella m.dallaste...@gmail.com ha scritto: Hi, We would like to use the Clojure logo for our new Italian Clojure User Group. Thank you all for your kind answer. We are not going to use any logo until Rich

Re: The rationale behind mutable namespaces?

2012-03-29 Thread Alf Kristian Støyle
Thanks Herwig, makes sense. Cheers, Alf On Mar 29, 2012 1:37 PM, Herwig Hochleitner hhochleit...@gmail.com wrote: 2012/3/29 Alf Kristian Støyle alf.krist...@gmail.com: So, long story short, why are namespaces in Clojure mutable? What is the rationale behind this? It's for REPL

Re: Cheap way to find function (defn) name using a macro?

2012-03-29 Thread Shantanu Kumar
On Mar 29, 11:46 pm, Cedric Greevey cgree...@gmail.com wrote: On Thu, Mar 29, 2012 at 2:36 PM, Shantanu Kumar kumar.shant...@gmail.com wrote: 81  (defn foo [...] 82    (let [x (compute-something ...)] 83      (do-something x ...) 84      (calculate-whatever ...))) and