Re: Drawbridge: a (Ring) HTTP transport for nREPL

2012-03-30 Thread Laurent PETIT
Awesome! One question : how to pass security credentials ? Le 29 mars 2012 à 23:43, Chas Emerick c...@cemerick.com a écrit : Drawbridge is an HTTP/HTTPS nREPL transport, implemented as a Ring handler: https://github.com/cemerick/drawbridge It also provides a client-side nREPL

Re: Drawbridge: a (Ring) HTTP transport for nREPL

2012-03-30 Thread Christophe Grand
It's just a web app, I guess you have to roll out your auth method of choice. On Fri, Mar 30, 2012 at 8:32 AM, Laurent PETIT laurent.pe...@gmail.comwrote: Awesome! One question : how to pass security credentials ? Le 29 mars 2012 à 23:43, Chas Emerick c...@cemerick.com a écrit :

Re: partition-distinct

2012-03-30 Thread David Jagoe
On 29 March 2012 21:41, Cedric Greevey cgree...@gmail.com wrote: On Thu, Mar 29, 2012 at 4:18 PM, David Jagoe davidja...@gmail.com wrote: 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)] ! (defn partition-distinct [s]  

Re: partition-distinct

2012-03-30 Thread Jay Fields
Here's a version with reduce. It returns your elements as sets, but you could easily (map seq ,,,) if you really need lists. user= (reduce (fn [r e] (if ((last r) e) (conj r #{e}) (update-in r [(dec (count r))] conj e))) [#{}] [1 2 2 3 4 4 1 6]) [#{1 2} #{2 3 4} #{1 4 6}] Cheers, Jay On

Re: partition-distinct

2012-03-30 Thread Tassilo Horn
David Jagoe davidja...@gmail.com writes: Hi David, Thanks! I had a nasty feeling that it could be done in a one-liner using partition-by or something similar. But of course you need to be able to look at previous elements... Here's a slightly shorter variant. --8---cut

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

2012-03-30 Thread Benjamin Peter
Hi, On Mar 29, 10:43 pm, Alan Malloy a...@malloys.org wrote: 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. I think this topic is interesting. My guess would be,

Re: Alternative download site for Clojure 1.3?

2012-03-30 Thread Chris Webster
Thanks for the advice, guys. I think it must just have been some temporary problem on the site, as I finally got it to download late last night. Now all I have to do is learn Clojure, eh? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: Howto make println run as fast as python's

2012-03-30 Thread Sean Neilan
Whoops! I'm sorry. I tried compiling my code into an uberjar and then ran (defn print2 [] (dotimes [n 99] (.println outoutout n))) from main It's very very fast!! Wow! On Thu, Mar 29, 2012 at 8:07 PM, sean neilan sneil...@gmail.com wrote: Hey All, I'm trying to print the numbers

Howto make println run as fast as python's

2012-03-30 Thread sean neilan
Hey All, I'm trying to print the numbers 0-99 as fast as possible. In python, this for i in range(99): print i runs super fast. In clojure, even with type hints, this is slow (def ^java.io.PrintWriter outoutout (java.io.PrintWriter. *out*)) ; yes, I know this one prints to infinity.

Re: Alternative download site for Clojure 1.3?

2012-03-30 Thread Murphy McMahon
Learning Clojure is the fun part. Setup and maintenance of the tools is a little less fun, IMO. But where there's a will (and a connection to freenode), there's a way. On Mar 30, 2012 9:09 AM, Chris Webster cmhwebs...@gmail.com wrote: Thanks for the advice, guys. I think it must just have

Where to post job ad

2012-03-30 Thread David Jagoe
G'day everyone I am increasingly relying on clojure and plan to use clojureclr and clojurescript in production too. I will soon need to hire a clojure developer and was hoping that someone could suggest a good place to post a job ad. I've never seen a job posted here but I would like to reach the

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

2012-03-30 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 11:59 PM, Shantanu Kumar kumar.shant...@gmail.com wrote: The change needs to be least intrusive and doesn't justify exposing more surface area than it should. It's a trade off. Injecting a version of defn that doesn't do anything different except make a new thing

Re: Where to post job ad

2012-03-30 Thread Devin Walters
On Friday, March 30, 2012 at 7:35 AM, David Jagoe wrote: G'day everyone I am increasingly relying on clojure and plan to use clojureclr and clojurescript in production too. I will soon need to hire a clojure developer and was hoping that someone could suggest a good place to post a job ad.

Re: Where to post job ad

2012-03-30 Thread David Powell
On Fri, Mar 30, 2012 at 1:35 PM, David Jagoe davidja...@gmail.com wrote: G'day everyone I am increasingly relying on clojure and plan to use clojureclr and clojurescript in production too. I will soon need to hire a clojure developer and was hoping that someone could suggest a good place to

Re: Where to post job ad

2012-03-30 Thread Tamreen Khan
Yep, just make sure to mention that it's an offer and the location in the subject to make it easy to spot. On Fri, Mar 30, 2012 at 11:39 AM, David Powell djpow...@djpowell.netwrote: On Fri, Mar 30, 2012 at 1:35 PM, David Jagoe davidja...@gmail.com wrote: G'day everyone I am increasingly

Re: Alternative download site for Clojure 1.3?

2012-03-30 Thread Tamreen Khan
And like Sean mentioned, using Leiningen *really* helps. Especially when you have Emacs with clojure set up as well. On Fri, Mar 30, 2012 at 8:17 AM, Murphy McMahon pande...@gmail.com wrote: Learning Clojure is the fun part. Setup and maintenance of the tools is a little less fun, IMO. But

Multiple ClojureScript (sub)projects with shared CLJS libraries per single clojure project

2012-03-30 Thread Tom Krestle
Hi, The project I envision would consist of multiple completely independent conglomerates of CLJS scripts compiled into several separate final production .js with one single Clojure server. The reason for that is: 1. Smaller size of .js to load at each stage 2. Each time a browser transitions

Re: Source code as metadata

2012-03-30 Thread Vinzent
Another idea is to put :indentation metadata on vars, so user-defined macros could be indented properly. Currently I have (define-clojure-indent ...) with a number of forms in my emacs config file, and it seems to be pretty common solution. It'd be nice to replace this hack with an

ClojureScript release 0.0-1006

2012-03-30 Thread Stuart Sierra
Just pushed to Sonatype. Will be sync'd to other repos within 24 hours. Changes: http://build.clojure.org/job/clojurescript-release/9/ -- 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: Multiple ClojureScript (sub)projects with shared CLJS libraries per single clojure project

2012-03-30 Thread Stuart Sierra
At Relevance we are working on a project with just this structure. The project has a custom build script that produces mulitple advanced-mode-compiled .js files. We have not developed anything that would be generally reusable, but it's not hard to create custom code to do this. The

Re: Multiple ClojureScript (sub)projects with shared CLJS libraries per single clojure project

2012-03-30 Thread Mark Rathwell
I haven't tried yet, but lein-cljsbuild [1] is meant to support multiple builds, and I believe something like the below config would be what you are looking for: :cljsbuild { :builds [{:source-path src/cljs/project1 :compiler {:output-to resources/public/cljs/script1.js

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

2012-03-30 Thread Larry Travis
I too think this is interesting because because it serves to illustrate some important general aspects of Clojure with a very simple problem. I wrote four Clojure programs contrasting different ways of solving the problem, and then timed the application of each ten times to a million-item

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Vinzent ru.vinz...@gmail.com writes: Phil, what do you think? Could it be experimentally implemented in clojure-mode? No, clojure-mode determines indentation exclusively from static heuristics. There is dynamic indentation support in slime, but I've never looked into it; I'm not sure how I

Re: Where to post job ad

2012-03-30 Thread Chas Emerick
David, You might want to try posting at Functional Jobs; I've heard good things about results from there: http://functionaljobs.com/ FYI, I have no affiliation or connection with whoever runs the service. Of course, tweet the opening. I think we'd all be surprised by how many jobs get

Re: Where to post job ad

2012-03-30 Thread Sean Corfield
On Fri, Mar 30, 2012 at 8:18 AM, Devin Walters dev...@gmail.com wrote: Try meetup.com and look for Clojure and/or Lispish groups. Contact them with details. I would be happy to put the word out in our group. Feel free to pass me details. Also LinkedIn has a Clojure group and that has a Jobs

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

2012-03-30 Thread Stephen Compall
On Thu, 2012-03-29 at 23:31 -0700, Benjamin Peter wrote: the sequence would have been traversed completely by the reduce call and therefore clojure could know it's size and provide a constant time count. Could this be implemented? Yes. You could probably implement it yourself, as a wrapper

Re: Multiple ClojureScript (sub)projects with shared CLJS libraries per single clojure project

2012-03-30 Thread Evan Mezeske
I can confirm Mark Rathewell's note; that's part of what lein-cljsbuild is meant to do. With his configuration, the script1.js and script2.js files would both be built, and each would only contain the code from the project1 or project2 directories, respectively (unless they require code from

Re: Source code as metadata

2012-03-30 Thread Nathan Matthews
Hi, I wanted to serialise functions and send them over the network. The problem with serializable-fn is that it doesn't capture closures. I wrote some code which re-programmed the fn macro to capture the closures as well as the actual function form, and attach them as meta-data also on the

Re: Where to post job ad

2012-03-30 Thread Joseph Smith
This seems like a good place. Where's the job? :) On Mar 30, 2012, at 7:35 AM, David Jagoe wrote: G'day everyone I am increasingly relying on clojure and plan to use clojureclr and clojurescript in production too. I will soon need to hire a clojure developer and was hoping that

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Nathan Matthews nathan.r.matth...@gmail.com writes: I wanted to serialise functions and send them over the network. The problem with serializable-fn is that it doesn't capture closures. It's designed to capture closures; if it doesn't that would be an (unsurprising) bug. -Phil -- You

kibit is to Clojure what SOUL is to Smalltalk

2012-03-30 Thread David Nolen
http://soft.vub.ac.be/SOUL/ This project is worth looking at for directions that kibit might want to go. It's also a good resource for cool ideas on how to leverage core.logic - miniKanren was designed from the get go to manipulate Lisp source. David -- You received this message because you

Re: Source code as metadata

2012-03-30 Thread Vinzent
I'm not sure how I feel about indentation rules changing depending on whether slime is active or not. What I was thinking, is that there'd be some function which would collect and save indentation metadata, so it can be used later. Thus, active slime connection required only the first time

Re: kibit is to Clojure what SOUL is to Smalltalk

2012-03-30 Thread Devin Walters
Nice find. Thanks, '(Devin Walters) On Friday, March 30, 2012 at 2:58 PM, David Nolen wrote: http://soft.vub.ac.be/SOUL/ This project is worth looking at for directions that kibit might want to go. It's also a good resource for cool ideas on how to leverage core.logic - miniKanren was

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Nathan Matthews nathan.r.matth...@gmail.com writes: I wrote some code which re-programmed the fn macro to capture the closures as well as the actual function form, and attach them as meta-data also on the actual function object. Could you submit it as a patch to serializable-fn? It would be

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Vinzent ru.vinz...@gmail.com writes: I'm not sure how I feel about indentation rules changing depending on whether slime is active or not. What I was thinking, is that there'd be some function which would collect and save indentation metadata, so it can be used later. Thus, active

Re: Where to post job ad

2012-03-30 Thread blcooley
On Mar 30, 7:35 am, David Jagoe davidja...@gmail.com wrote: G'day everyone I am increasingly relying on clojure and plan to use clojureclr and clojurescript in production too. I will soon need to hire a clojure developer and was hoping that someone could suggest a good place to post a job

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
On Fri, Mar 30, 2012 at 1:26 PM, Vinzent ru.vinz...@gmail.com wrote: Another idea is to put :indentation metadata on vars, so user-defined macros could be indented properly. Currently I have (define-clojure-indent ...) with a number of forms in my emacs config file, and it seems to be pretty

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
On Fri, Mar 30, 2012 at 2:48 PM, Nathan Matthews nathan.r.matth...@gmail.com wrote: Also it bothers me that (= (partial * 2) (partial * 2)) is false. Logically it shouldn't be right?  If we captured the function forms, that would enable better equality for functions. That opens a giant can

Re: Source code as metadata

2012-03-30 Thread Vinzent
Probably you slightly misunderstood what I mean. Consider this scenario: I've set up a project which uses a new library with non-standart indent. I've connected to swank and compiled it. Then I'm calling some clojure-mode-update-indent function, which walks through all loaded namespaces and

Re: Source code as metadata

2012-03-30 Thread Vinzent
Counter-example: one could write if-authenticated macro, which will take fixed number of args, but should be indented as normal if. суббота, 31 марта 2012 г. 3:07:23 UTC+6 пользователь Cedric Greevey написал: On Fri, Mar 30, 2012 at 1:26 PM, Vinzent ru.vinz...@gmail.com wrote: Another idea

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Vinzent ru.vinz...@gmail.com writes: Probably you slightly misunderstood what I mean. Consider this scenario: I've set up a project which uses a new library with non-standart indent. I've connected to swank and compiled it. Then I'm calling some clojure-mode-update-indent function, which

Better ways to make time tansformations?

2012-03-30 Thread Goldritter
I wanted to track a program and set a maximum runtime for it in a way which is readable for the user. So I needed to write a time tansformation which I could use in my track function. First I wanted to use something like the 'defunits' macro from Let over Lambda from Doug Hoyte, but I'm not so fit

Re: ClojureScript release 0.0-1006

2012-03-30 Thread Evan Mezeske
Awesome, I've been looking forward to this release. The new release has made it out to the upstream maven repository. I just pushed out lein-cljsbuild 0.1.4, which has the new 0.0-1006 dependency (as well as some other features [1]. It works on my personal projects! -Evan [1]

Re: Source code as metadata

2012-03-30 Thread Lee Spector
On Mar 30, 2012, at 5:11 PM, Cedric Greevey wrote: That opens a giant can of worms. How, for example, do we discover that (partial * 2) and #(* % 2) and (fn [x] (* 2 x)) and #(+ %1 %1) are all equal? Nevermind once we get into situations like #(reduce + (map (constantly 1) %) equals #(loop

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
2012/3/30 Vinzent ru.vinz...@gmail.com: Counter-example: one could write if-authenticated macro, which will take fixed number of args, but should be indented as normal if. OK, check the macro structure to see if any args are incorporated as invokable forms -- so, in arguments in special forms

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
On Fri, Mar 30, 2012 at 6:17 PM, Lee Spector lspec...@hampshire.edu wrote: On Mar 30, 2012, at 5:11 PM, Cedric Greevey wrote: That opens a giant can of worms. How, for example, do we discover that (partial * 2) and #(* % 2) and (fn [x] (* 2 x)) and #(+ %1 %1) are all equal? Nevermind once we

[ANN] data.zip 0.1.1

2012-03-30 Thread Aaron Bedra
Hi everyone, Thanks to a patch from Justin Kramer, data.zip now works properly with the updates to data.xml. dependency groupIdorg.clojure/groupId artifactIddata.zip/artifactId version0.1.1/version /dependency or [org.clojure/data.zip 0.1.1] Cheers, Aaron -- You received

Re: ClojureScript release 0.0-1006

2012-03-30 Thread Dave Sann
A quick comment on item 13 in the release. I think that this sort causes some code that I have to fail. The reason is that the code in question inserts js scripts into the header of the page - when bootstrap loads. Subsequent modules require this js to be present - but do not depend on it.

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

2012-03-30 Thread simon.T
Hi Rob, Appreciate it, I like the code and explanation, great! Simon On Thursday, March 29, 2012 6:28:48 PM UTC+8, Rob Nagle wrote: 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

What is fn*, fn suffixed with asterisk?

2012-03-30 Thread simon.T
Recently, when looking into the clojure source code, core.clj in particular, I found multiple occurrence of 'fn*' instead of 'fn'. Can anyone help explain what fn* is and the difference between fn and fn* Thanks Simon -- You received this message because you are subscribed to the Google

Re: What is fn*, fn suffixed with asterisk?

2012-03-30 Thread Timothy Baldridge
fn* is a compiler intrinsic...it's pretty low-level, it doesn't support destructuring,. So instead, core.clj creates a macro called fn that adds all this other functionality and eventually spits out the fn* in a format the compiler wants. Basically it's set up this way so that you can write the

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

2012-03-30 Thread Sean Corfield
On Fri, Mar 30, 2012 at 11:01 AM, Larry Travis tra...@cs.wisc.edu wrote: user= (time (dotimes [i 10] (average1 mill-float-numbs))) Elapsed time: 526.674 msecs user= (time (dotimes [i 10] (average2 mill-float-numbs))) Elapsed time: 646.608 msecs user= (time (dotimes [i 10] (average3