Re: alternative to passing parameters to functions

2013-02-18 Thread Gunnar Völkel
You can checkout clojure.options (https://github.com/guv/clojure.options/). One of its main features is documentation for options (even transitive ones in calls to other functions with options). -- -- You received this message because you are subscribed to the Google Groups Clojure group. To

Multiple subselects, korma

2013-02-18 Thread Omer Iqbal
Hey folks, I'm using korma 0.3.0 RC4 in a project, and wanted to know what's the idiomatic way to perform a union of two subselects. e.g. Something of this sort (select foo (where {:somefield [in (subselect ...) (subselect ...)]}))

Re: STM in Clojure vs Haskell, why no retry or orElse?

2013-02-18 Thread Tom Hall
OK, I guess the essence is: Why does Clojure not need retry or orElse when another implementer of STM considers them essential? I'm guessing it's because clojures in MVCC but would like confirmation and perhaps links to comparisons between STMs and maybe a guide to Clojures. How would you solve

Re: RC 16: Last chance to test against Clojure 1.5 before it ships

2013-02-18 Thread Dave Sann
I don't expect this to go into 1.5. But the point raised by vemv is a good one. Clojurescript makes ExceptionInfo available by default. If this were also the case in clojure - it would help with portable code. Specifically catching ExceptionInfo. (longer comments on the thread referenced

Re: with-redefs for vars in a different namespace for tests (midje facts)

2013-02-18 Thread Brian Marick
On Feb 17, 2013, at 8:49 PM, Leonardo Borges leonardoborges...@gmail.com wrote: My theory behind why this works is that when I reload the cache namespace it recompiles it - and at that point, the new var binding is available. Is this the case? More importantly, is this how I should be

Re: RC 16: Last chance to test against Clojure 1.5 before it ships

2013-02-18 Thread vemv
Your additional points make more evident the need to put some final effort on the design of ExceptionInfo - leaving it alpha would be pretty unfortunate. On Monday, February 18, 2013 2:05:39 PM UTC+1, Dave Sann wrote: I don't expect this to go into 1.5. But the point raised by vemv is a

Re: STM in Clojure vs Haskell, why no retry or orElse?

2013-02-18 Thread Philip Potter
On 18 February 2013 12:30, Tom Hall thattommyh...@gmail.com wrote: OK, I guess the essence is: Why does Clojure not need retry or orElse when another implementer of STM considers them essential? What are retry and orElse? What do they do? I'm guessing it's because clojures in MVCC but would

The case for as- (as-last)

2013-02-18 Thread vemv
While there are other possible uses (examplehttps://twitter.com/borkdude/status/302881431649128448), I see myself mainly using as- as a mechanism for resorting to thread-last within a thread-first expression. For example, given (- [[1 1 1] 2 3] (nth 0)) I might want to add an operation that

Re: How to bind an Aleph TCP server to a TCP v4 port?

2013-02-18 Thread Jorge Luis Pérez
Hi Peter, You was right! I append the -Djava.net.preferIPv4Stack=true option in the project file: (defproject clj-echo-server 0.1.0-SNAPSHOT :description Echo server with Aleph :url http://example.com/FIXME; :license {:name Eclipse Public License :url

reflection used for (or ...) and (into-array ...)

2013-02-18 Thread AtKaaZ
For *or* = *(set! *warn-on-reflection* true) (def ^Integer a 1) (java.awt.Color. 0 0 ^Integer (or ^Integer a 0) 0) *clojure-version** true #'cgws.notcore/a Reflection warning, NO_SOURCE_PATH:3:1 - call to java.awt.Color ctor can't be resolved. #Color java.awt.Color[r=0,g=0,b=1] {:major 1,

Re: reflection used for (or ...) and (into-array ...)

2013-02-18 Thread Andy Fingerhut
Integer is a boxed integer in Java. It is a full Java Object. The java.awt.Color constructor you are calling takes 4 primitive int parameters, not Integer. Try this: (set! *warn-on-reflection* true) (def a 1) (java.awt.Color. (int 0) (int 0) (int (or a 0)) (int 0)) I'm not so sure what you

Loading in jars with dependencies at runtime into separate classloaders with independent classpaths

2013-02-18 Thread Adam Clements
I'm working on a web api wrapper around a number of java/clojure libraries. One problem that I have run into is transitive dependency conflicts, especially when some of the projects are older than others. What I want to do is have each API endpoint's final handler function in its own

Re: Loading in jars with dependencies at runtime into separate classloaders with independent classpaths

2013-02-18 Thread Toby Crawley
Adam: You can do this exact thing in Immutant[1]. It can handle multiple applications at the same time, with each application getting an isolated ClassLoader. Each application can optionally have its dependencies resolved at deploy time via pomegranate, and can be (re)deployed independently of

Re: reflection used for (or ...) and (into-array ...)

2013-02-18 Thread AtKaaZ
Thank you for the reply. Does this *(int (or a 0)) *incur any runtime penalty when compared to ^int (if that would be possible) ? (answer: insignificat) Well I'll test: = *(def a 1)* #'seesaw.layout/a = (time (dorun (doseq [x (take 1000 (range))] (java.awt.Color. 0 0 *(int a)* 0

Re: reflection used for (or ...) and (into-array ...)

2013-02-18 Thread Marko Topolnik
A side note: dorun makes no sense around doseq since doseq returns nil and dorun operates on a lazy seq. On Monday, February 18, 2013 8:16:16 PM UTC+1, AtKaaZ wrote: = (time (dorun (doseq [x (take 1000 (range))] (java.awt.Color. 0 0 *(int a)* 0 Elapsed time: 7352.883635 msecs

Re: The case for as- (as-last)

2013-02-18 Thread Marko Topolnik
On Monday, February 18, 2013 5:40:51 PM UTC+1, vemv wrote: And neither can be solved by adding a lambda: (- [[1 1 1] 2 3] (nth 0) #(map inc %)) ;; fail Lambda does solve it, you are just missing the parens around the lambda: (- [[1 1 1] 2 3] (nth 0) (#(map inc %))) Clojure 1.5's as-,

Re: reflection used for (or ...) and (into-array ...)

2013-02-18 Thread AtKaaZ
awesome! I wasn't thinking at all about that, I just remember something returned lazyseq and I just had to make sure, but was too lazy to think about it :) Much appreciated! Thanks! On Mon, Feb 18, 2013 at 8:36 PM, Marko Topolnik marko.topol...@gmail.comwrote: A side note: dorun makes no

nrepl-ritz setup (missing dependency dynapath)

2013-02-18 Thread Dima B
Hi, I've been going through all the instruction on the nrepl-ritz page (https://github.com/pallet/ritz/tree/develop/nrepl) as well as nrepl-ritz threads and I can't seem to get it working due to a mysterious dependency problem on dynapath. M-x nrepl-ritz-jack-in results in Starting nREPL

Re: The case for as- (as-last)

2013-02-18 Thread Víctor M . V .
That extra parenses trick is neat, never thought of that! As for as- being redundant - it could be considered so indeed, given that as- can be lambified: (- [] (#(as- % x (map inc x - but that's pretty damn ugly haha. If you were thinking something else, please let me know. Thanks - Victor

Re: The case for as- (as-last)

2013-02-18 Thread Víctor M . V .
Fair enough. Now I'm beggining to truly appreciate as-, thank you. I still believe as- would be somewhat useful but I don't see it getting added to clojure.core now. On Mon, Feb 18, 2013 at 9:10 PM, Marko Topolnik marko.topol...@gmail.comwrote: as- is meant to be used as the only threading

Re: nrepl-ritz setup (missing dependency dynapath)

2013-02-18 Thread Hugo Duncan
Dima B dimath...@gmail.com writes: I've been going through all the instruction on the nrepl-ritz page (https://github.com/pallet/ritz/tree/develop/nrepl) as well as nrepl-ritz threads and I can't seem to get it working due to a mysterious dependency problem on dynapath. Which version of

Re: STM in Clojure vs Haskell, why no retry or orElse?

2013-02-18 Thread Tom Hall
Why does Clojure not need retry or orElse when another implementer of STM considers them essential? What are retry and orElse? What do they do? I had hoped to get a reply from someone with experience of both, as the quote suggests they are for blocking and choice (The article was the first

ANN Gavagai 0.3.1 released

2013-02-18 Thread Nils Grunwald
Gavagai is a library dedicated to facilitating the creation of Clojure wrapper around Java libraries. It enables a simple, declarative way to automatically convert recursive graphs of Java objects to Clojure immutable and lazy data structures. You can find out more about this project

Re: nrepl-ritz setup (missing dependency dynapath)

2013-02-18 Thread Toby Crawley
Dima B writes: Hi, I've been going through all the instruction on the nrepl-ritz page (https://github.com/pallet/ritz/tree/develop/nrepl) as well as nrepl-ritz threads and I can't seem to get it working due to a mysterious dependency problem on dynapath. ... error in process sentinel:

Re: nrepl-ritz setup (missing dependency dynapath)

2013-02-18 Thread Hugo Duncan
Toby Crawley t...@tcrawley.org writes: * I can release a new version that is compatible with 0.1.0 and 0.2.x, requiring you do depend on it (and possibly exclude other versions) * I can update ritz to use 0.2.1, and Hugo can make a new release (if he is amenable to that). As far as I

Re: nrepl-ritz setup (missing dependency dynapath)

2013-02-18 Thread Toby Crawley
Hugo Duncan writes: The latter is fine by me. It is about time we had another ritz release for nrepl.el 1.6 anyway. I'll send you a PR in a few minutes. -- Toby Crawley http://immutant.org | http://torquebox.org -- -- You received this message because you are subscribed to the Google

Re: nrepl-ritz setup (missing dependency dynapath)

2013-02-18 Thread Dima B
Which version of ritz? Ritz is 0.6.0, emacs plug-in is also 0.6.0. Clojure 1.4.0. Lein 2.0. I believe the midje plugin does have a dependency on dynapath 2.x that explains the mystery. Thank you for looking into this! On Monday, February 18, 2013 12:36:20 PM UTC-8, Hugo Duncan wrote: Dima

Re: nrepl-ritz setup (missing dependency dynapath)

2013-02-18 Thread Hugo Duncan
Toby Crawley t...@tcrawley.org writes: Hugo Duncan writes: The latter is fine by me. It is about time we had another ritz release for nrepl.el 1.6 anyway. I'll send you a PR in a few minutes. Thanks. Released in ritz 0.7.0 -- -- You received this message because you are subscribed to

Re: nrepl-ritz setup (missing dependency dynapath)

2013-02-18 Thread Dima B
I confirm that the issue is fixed. Thank you, guys! On Monday, February 18, 2013 3:39:37 PM UTC-8, Hugo Duncan wrote: Toby Crawley to...@tcrawley.org javascript: writes: Hugo Duncan writes: The latter is fine by me. It is about time we had another ritz release for nrepl.el 1.6

Re: alternative to passing parameters to functions

2013-02-18 Thread AtKaaZ
Thanks guys, I think I will go with this variant that vemv suggested and upon further exploring I realized it can do much more (still exploring currently): *(defn somefn [req1 req2 **;required params * * {:keys [a b c d e]** ;optional params* *:or {a 1** ;optional params with preset

Clojure Performance For Expensive Algorithms

2013-02-18 Thread Geo
Hello, I am cross-posting my Clojure question from StackOverflow. I am trying to get an algorithm in Clojure to match Java speed and managed to get the performance to within one order of magnitude and wondering if more is possible. The full question is here:

Re: RC 16: Last chance to test against Clojure 1.5 before it ships

2013-02-18 Thread Tim McCormack
On Wednesday, February 13, 2013 10:33:42 PM UTC-5, Stuart Halloway wrote: If you care about Clojure 1.5 compatibility for your codebase, please test it against RC 16 as soon as possible. (I mistakenly posted this already to the *read-eval* thread, but it really belongs here... apologies for

ANN LispCast Videos

2013-02-18 Thread Eric Normand
Hi, I thought this might interest Clojure programmers. I have a Kickstarter project to create screencasts to introduce people to Clojure. The project so far is doing well, but there is still a ways to go. One hour of video is set at a very good price ($5). If it does well, I hope to create

Re: Clojure Performance For Expensive Algorithms

2013-02-18 Thread Andy Fingerhut
This won't get you all of the way to Java speeds, or at least it didn't for me, but try these things: Use: (set! *warn-on-reflection* true) (set! *unchecked-math* true) The first won't speed anything up, but it will warn you about some things that are slow. The second will use unchecked