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

2013-02-19 Thread Mikera
This is sensible because: java.lang.* is important for interop (classes like Object,String etc.) and is pretty much guaranteed to retain backwards compatibility for the foreseeable future. It's pretty much the JVM equivalent of the clojure.core namespace. clojure.lang.* has a lot of classes /

[ANN] Javelin, spreadsheet-like FRP for ClojureScript

2013-02-19 Thread Alan Dipert
Hi all, We recently released a ClojureScript library for FRP called Javelin. Links of interest: * Release announcement: http://tailrecursion.com/blog/2013/02/15/introducing-javelin-an-frp-library-for-clojurescript/ * Demos (more on the way): http://tailrecursion.com/~alan/javelin-demos/ * GitH

Re: clj/cljs best practice

2013-02-19 Thread Alan Dipert
Hi Mimmo, I can't speak to what practice is best, but I can explain the Javelin Leiningen and lein-cljsbuild configuration. A ClojureScript library like Javelin usually has no compiled pieces to distribute the way a Clojure program that uses AOT or a Java program might. The only example I can

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread Sean Corfield
Oh cool, Christophe has finally removed the version range! Yay! I'll have to upgrade Enlive at work... that's been driving me nuts for a while :) Version ranges: just say no! :) Sean On Tue, Feb 19, 2013 at 10:14 PM, Nelson Morris wrote: > While [enlive "1.1.0"] does have the range removed, it

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread Nelson Morris
While [enlive "1.1.0"] does have the range removed, it looks like [enlive "1.1.1"] is the latest. On Wed, Feb 20, 2013 at 12:13 AM, Nelson Morris wrote: > The dependency with the version range is [enlive "1.0.1"]. You can > either add an exclusion, or update to [enlive "1.1.0"] which does not >

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread Nelson Morris
The dependency with the version range is [enlive "1.0.1"]. You can either add an exclusion, or update to [enlive "1.1.0"] which does not have a version range. https://github.com/cgrand/enlive/issues/37. There are some changes that need to happen to pomegranate and then I'll make a better way to d

Re: Like "if", but it composes functions

2013-02-19 Thread Alan Malloy
Sorry, forgot to link to useful: https://github.com/flatland/useful/blob/develop/src/flatland/useful/fn.clj#L30 On Tuesday, February 19, 2013 9:53:57 PM UTC-8, James MacAulay wrote: > > Sometimes I find myself writing code like this: > > (defn magnify [n] (if (pos? n) (inc n) (dec n))) > > ...an

Re: Like "if", but it composes functions

2013-02-19 Thread Alan Malloy
Useful has functions that do this and more: fix or to-fix, according to taste. Your iffn is just the three-argument case of to-fix: (def magnify (to-fix pos? inc dec)). But fix and to-fix accept more or fewer arguments as well, so that (fix x pos? inc) is like (if (pos? x) (inc x) x), and (to-f

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

2013-02-19 Thread Sean Corfield
This raises a question I've wondered about for a while: I believe Clojure makes java.lang.* available by default but not clojure.lang.* - what is the logic behind that? (I'm not questioning whether it's right or wrong, just curious as to why...) Thanx, Sean On Mon, Feb 18, 2013 at 5:05 AM, Dave S

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread Nelson Morris
Basically, yes. They left a version range. Aether (which lein and maven use underneath) will download all the poms in the range before making a decision. On Tue, Feb 19, 2013 at 1:28 PM, larry google groups wrote: > If I understand that, then, if one of my dependencies left their > version of C

Re: Like "if", but it composes functions

2013-02-19 Thread Ben Wolfson
You don't need a macro for this: user> (defn conditionalize [pred then else] (fn [& args] (if (apply pred args) (apply then args) (apply else args #'user/conditionalize user> ((conditionalize pos? inc dec) 3) 4 user> ((conditionalize po

Like "if", but it composes functions

2013-02-19 Thread James MacAulay
Sometimes I find myself writing code like this: (defn magnify [n] (if (pos? n) (inc n) (dec n))) ...and I want to get rid of all those "n"s. I've looked for a macro like this, but couldn't find it, so I wrote it: https://gist.github.com/jamesmacaulay/4993062 Using that, I could re-write the ab

Re: kerodon tests explode on lazyseq (session app)

2013-02-19 Thread Nelson Morris
It was a bug in kerodon that happens when a ring response has a :body that is a not a string (in this case a lazyseq). Reported and fixed by Travis Vachon at https://github.com/xeqi/kerodon/pull/6, I just had lost track of making a release for it. Fixed as part of [kerodon "0.1.0"]. On Tue, Feb

Re: nREPL + Emacs: How to get new definitions to load reliably?

2013-02-19 Thread Karl Smeltzer
Thanks for the suggestion, but this doesn't actually seem to solve the problem. This still requires bringing up the file containing the first namespace, which is what I want to avoid doing. On Tuesday, February 19, 2013 1:28:00 PM UTC-8, AtKaaZ wrote: > > you could include a :reload to your :us

Re: kerodon tests explode on lazyseq (session app)

2013-02-19 Thread AtKaaZ
oh sorry I meant: => (doall 1) IllegalArgumentException Don't know how to create ISeq from: java.lang.Long clojure.lang.RT.seqFrom (RT.java:505) clojure.lang.RT.seq (RT.java:486) clojure.core/seq (core.clj:133) clojure.core/dorun (core.clj:2780) clojure.core/doall (core.clj:2796

Re: kerodon tests explode on lazyseq (session app)

2013-02-19 Thread AtKaaZ
=> (dorun 1) IllegalArgumentException Don't know how to create ISeq from: java.lang.Long clojure.lang.RT.seqFrom (RT.java:505) nil IllegalArgumentException Don't know how to create ISeq from: java.lang.Long clojure.lang.RT.seqFrom (RT.java:505) clojure.lang.RT.seq (RT.java:486) clojure

Re: kerodon tests explode on lazyseq (session app)

2013-02-19 Thread larry google groups
Hmm, even stranger. If I wrap "app" in doall in an attempt to make the lazyseq error go away, I get: ERROR in (anyone-can-view-frontpage) (RT.java:494) Uncaught exception, not in assertion. expected: nil   actual: java.lang.IllegalArgumentException: Don't know how to create ISeq from: ring.middlew

Re: What is the difference between *source-path* and *file*?

2013-02-19 Thread Colin Jones
Yeah, there's been a patch in JIRA for that since 2010, and an updated one since October 2012: http://dev.clojure.org/jira/browse/CLJ-196 On Tuesday, February 19, 2013 1:08:22 PM UTC-6, Brian Marick wrote: > > By the way, the doc string for `*file*` is wrong: > > > clojure.core/*file* > > The

Re: nREPL + Emacs: How to get new definitions to load reliably?

2013-02-19 Thread AtKaaZ
you could include a :reload to your :use ns2 in ns1 but I don't recommend it. (it did bit me even with defonce when I wanted to keep some global state but clear it after deftest tests) (ns somewhere.namespace1 (:use [somewhere.namespace2 :as ns2] :reload)) ;;or maybe :reload-all I'm sure there'

nREPL + Emacs: How to get new definitions to load reliably?

2013-02-19 Thread Karl Smeltzer
Suppose I have two namespaces (ns1 and ns2) and the first "uses" the second. When I load ns1 and switch to its namespace in nREPL, everything works as expected. If I then make changes to existing definitions in ns2 and reload that file, everything still works as expected. Finally, when I try

clj/cljs best practice

2013-02-19 Thread Mimmo Cosenza
Hi all, as someone perhaps remember, few days ago I asked about the state of feature expressions which appeared to be immutable ;-) from july 2012. David Nolen gave us a hope to have them in the 1.6 version. I'm studying the javelin lib which has been recently release. I alway start from proj

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread AtKaaZ
On Tue, Feb 19, 2013 at 8:31 PM, AtKaaZ wrote: > if they have their dependency like this: > > "org.clojure:clojure:[1.2,1.5)" > > notice the ) at the end, instead of ] > > which was(maybe still is?) the case of i18n > > j18n not i18n, typo But one way you can know if it's a dep in your profiles.

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread AtKaaZ
if they have their dependency like this: "org.clojure:clojure:[1.2,1.5)" notice the ) at the end, instead of ] which was(maybe still is?) the case of i18n On Tue, Feb 19, 2013 at 8:28 PM, larry google groups < lawrencecloj...@gmail.com> wrote: > If I understand that, then, if one of my depe

Re: help make a macro that takes an input and will evaluate only the unquoted parts

2013-02-19 Thread Brandon Bloom
Shameless self-promotion: https://github.com/brandonbloom/backtick On Tuesday, February 19, 2013 1:35:28 PM UTC-5, AtKaaZ wrote: > > I am trying (but failing) to find a way to have a macro like: > => *(xmacro* {:a (+ 1 2) :b ~(+ 1 3)}) > {:a (clojure.core/+ 1 2), :b 4} > ;*without specifying the b

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread larry google groups
If I understand that, then, if one of my dependencies left their version of Clojure unspecified, then lein will download all the poms and then decide which jar to use? On Feb 19, 2:15 pm, AtKaaZ wrote: > ok I found the > log:http://www.raynes.me/logs/irc.freenode.net/leiningen/2013-02-01.txt >

kerodon tests explode on lazyseq (session app)

2013-02-19 Thread larry google groups
I was trying to follow this video, which adds some nice tests for Friend: http://www.clojurewebdevelopment.com/videos/friend-interactive-form But Kerodon gives me an error, and points to line 13 of my test code: ERROR in (anyone-can-view-frontpage) (impl.clj:73) Uncaught exception, not in assert

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread AtKaaZ
ok I found the log: http://www.raynes.me/logs/irc.freenode.net/leiningen/2013-02-01.txt On Tue, Feb 19, 2013 at 8:05 PM, AtKaaZ wrote: > could've been someone else with the same problem, sorry for implying. > I do remember something about ring having an ")" for clojure 1.5.0 and the > projects

Re: What is the difference between *source-path* and *file*?

2013-02-19 Thread Brian Marick
Duh. I'd managed to confuse myself. Sorry for the noise. (*file*: "t_core.clj"; *source-path*: "scratch/t_core.clj") Looking for employment as a Clojure programmer Latest book: /Functional Programming for the Object-Oriented Programmer/ https://leanpub.com/fp-oo -- -- You received thi

What is the difference between *source-path* and *file*?

2013-02-19 Thread Brian Marick
By the way, the doc string for `*file*` is wrong: > clojure.core/*file* > The path of the file being evaluated, as a String. > > Evaluates to nil when there is no file, eg. in the REPL. > It actually evaluates to "NO_SOURCE_PATH" Looking for employment as a Clojure programmer Late

Re: Possible bug with realized? and cancelled futures

2013-02-19 Thread Marko Topolnik
It could be that actually the *realized?* docstring needs change or clarification because a future can be realized in one of two ways: a value or a failure. Both count as realized in the sense that they are the *outcome * of the future; in other words, *realized?* evaluating to true* *gives the

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread AtKaaZ
could've been someone else with the same problem, sorry for implying. I do remember something about ring having an ")" for clojure 1.5.0 and the projects.clj file was: {:user {:plugins [[lein-swank "1.4.4"] [lein-catnip "0.5.0"]]} :dev {:dependencies [[clj-ns-browser "1.2.0"]

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread larry google groups
On Feb 19, 12:25 pm, Phil Hagelberg wrote: > larry google groups writes: > > Thanks for the suggestion. I run "lein deps :tree" but I do not see > > Clojure 1.5 listed as a dependency anywhere. But if I run: > > Some unfortunate dependency is declaring a version range dependency on > Clojure. If

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread larry google groups
> I think we solved this once on irc and it was something in your project*s*.clj > but I can't remember exactly, if you want you can post its contents... > I have never been on the irc channel, so that wasn't me. On Feb 19, 12:09 pm, AtKaaZ wrote: > I think we solved this once on irc and it

Re: help make a macro that takes an input and will evaluate only the unquoted parts

2013-02-19 Thread AtKaaZ
bbloom on irc suggested this: https://github.com/brandonbloom/backtick and looks like *template *is the macro I was looking for => (template {:a (+ 1 2) c d :b ~(+ 1 3)}) {:a (+ 1 2), :b 4, c d} Totally awesome! On Tue, Feb 19, 2013 at 7:35 PM, AtKaaZ wrote: > I am trying (but failing) to find

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

2013-02-19 Thread Mark Engelberg
On Mon, Feb 18, 2013 at 1:41 PM, Tom Hall wrote: > I think it's a shame he wrote the article around Christmas and chose a > less well known problem, I have looked at several Clojure Barbershop > Problem solutions so have a better idea now what an idiomatic solution > to this sort of problem might

Re: help make a macro that takes an input and will evaluate only the unquoted parts

2013-02-19 Thread Jordan Berg
Not sure if it is exactly what you are looking for, but that looks fairly similar to how string interpolation works: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/strint.clj Maybe you can somehow make that work for you? On Tue, Feb 19, 2013 at 1:35 PM, AtKa

help make a macro that takes an input and will evaluate only the unquoted parts

2013-02-19 Thread AtKaaZ
I am trying (but failing) to find a way to have a macro like: => *(xmacro* {:a (+ 1 2) :b ~(+ 1 3)}) {:a (clojure.core/+ 1 2), :b 4} ;*without specifying the backquote ` on the input* I need it to behave like this: => (*eval '`*{:a (+ 1 2) :b ~(+ 1 3)}) {:a (clojure.core/+ 1 2), :b 4} But I don't

Re: Possible bug with realized? and cancelled futures

2013-02-19 Thread AtKaaZ
also check this: https://groups.google.com/d/msg/clojure/xlhDSPZGrL4/C9EGFvlqOZ8J On Tue, Feb 19, 2013 at 7:13 PM, Alex Nixon wrote: > Hey Peter, > > On 19 February 2013 17:55, Peter Taoussanis wrote: > >> Hi Alex, >> >> This is a problem because the print-method multimethod implementation for

Re: Possible bug with realized? and cancelled futures

2013-02-19 Thread Alex Nixon
Hey Peter, On 19 February 2013 17:55, Peter Taoussanis wrote: > Hi Alex, > > This is a problem because the print-method multimethod implementation for >> clojure.lang.IDeref assumes that if the .isRealized method returns true, >> it's safe to deref the instance. >> > > That's interesting. I've r

Re: Clojure Performance For Expensive Algorithms

2013-02-19 Thread Geo
Cool. Thanks for the explanation. On Tuesday, February 19, 2013 12:47:05 PM UTC-5, Marko Topolnik wrote: > > Naturally, it's Object#equals. String's override of equals gets involved > without the checked downcast. > > On Tuesday, February 19, 2013 6:38:07 PM UTC+1, Geo wrote: >> >> What about the

Re: Possible bug with realized? and cancelled futures

2013-02-19 Thread Peter Taoussanis
Hi Alex, This is a problem because the print-method multimethod implementation for > clojure.lang.IDeref assumes that if the .isRealized method returns true, > it's safe to deref the instance. > That's interesting. I've run into the case before where a cancelled future was throwing an exceptio

Re: Clojure Performance For Expensive Algorithms

2013-02-19 Thread Marko Topolnik
Naturally, it's Object#equals. String's override of equals gets involved without the checked downcast. On Tuesday, February 19, 2013 6:38:07 PM UTC+1, Geo wrote: > > What about the call to .equals? > > On Tuesday, February 19, 2013 12:20:28 PM UTC-5, Marko Topolnik wrote: >> >> The difference bet

Re: Clojure Performance For Expensive Algorithms

2013-02-19 Thread Geo
What about the call to .equals? On Tuesday, February 19, 2013 12:20:28 PM UTC-5, Marko Topolnik wrote: > > The difference between String[] and Object[] is that a member of the > former doesn't need a checked cast to String, but the latter does need one. > In the code under consideration, however

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

2013-02-19 Thread Phil Hagelberg
Adam Clements writes: > 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. If you are dealing solely with conflicts in Clojure code and

Possible bug with realized? and cancelled futures

2013-02-19 Thread Alex Nixon
Hey all, The docstring of clojure.core/realized? states "Returns true if a value has been produced for a promise, delay, future or lazy sequence.", however calling realized? on a cancelled future returns true, despite the fact a value *has not* been produced. This is a problem because the print-

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread Phil Hagelberg
larry google groups writes: > Thanks for the suggestion. I run "lein deps :tree" but I do not see > Clojure 1.5 listed as a dependency anywhere. But if I run: Some unfortunate dependency is declaring a version range dependency on Clojure. If you can figure out which one it is, you should report

Re: Clojure Performance For Expensive Algorithms

2013-02-19 Thread Marko Topolnik
The difference between String[] and Object[] is that a member of the former doesn't need a checked cast to String, but the latter does need one. In the code under consideration, however, nothing specific to String is used, so even in the Java code you can freely replace String[] with Object[] an

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread AtKaaZ
I think we solved this once on irc and it was something in your project*s*.clj but I can't remember exactly, if you want you can post its contents... Cheers On Tue, Feb 19, 2013 at 5:49 PM, larry google groups < lawrencecloj...@gmail.com> wrote: > Thanks for the suggestion. I run "lein deps :tr

Re: Clojure Performance For Expensive Algorithms

2013-02-19 Thread Geo
Note that I'm not very confident that using long-array instead of int-array is a true improvement vs. just noise. On Tuesday, February 19, 2013 11:46:21 AM UTC-5, Geo wrote: > > Using long-array instead of int-array seems to produce a very slight but > noticeable improvement. (~2.1 sec -> ~1.8 s

Re: Clojure Performance For Expensive Algorithms

2013-02-19 Thread Andy Fingerhut
^objects is a Clojure synonym for ^"[Ljava.lang.Object;". Note that there are such synonyms for only a few Java types, not everything, e.g. there is no ^strings. What you are hinting is that a1 and a2 are Java arrays of objects. I think this might speed up (aget a1 i) expressions, since it is

Re: why did lein just download Clojure 1.5?

2013-02-19 Thread larry google groups
Thanks for the suggestion. I run "lein deps :tree" but I do not see Clojure 1.5 listed as a dependency anywhere. But if I run: lein uberjar I get a lot of clojure-1.5.pom's getting downloaded. Does anyone know why I get so many of these? As I said before, I am using Clojure 1.4. Clojure 1.5 is no

Re: Clojure Performance For Expensive Algorithms

2013-02-19 Thread Geo
One thing I don't get is that switching the type hints from [#^"[Ljava.lang.String;" a1 #^"[Ljava.lang.String;" a2] to [^objects a1 ^objects a2] didn't seem to have any negative impact on performance. Can anyone explain why hinting ^objects is just as good as specifying that it's an array of S

Re: Clojure Performance For Expensive Algorithms

2013-02-19 Thread Geo
Using long-array instead of int-array seems to produce a very slight but noticeable improvement. (~2.1 sec -> ~1.8 sec) = 1.16x improvement One other thing is that loop seems to return boxed primitives, so by wrapping the inner loop with (long ) I got another slight performance gain. (~2.5 sec

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

2013-02-19 Thread Toby Crawley
Adam Clements writes: > I don't really want to migrate my whole app to immutant's framework right > now though (plus I'm just interested in how one might employ this pattern > for things other than web apps too) so I've been looking through to see if > I can work out how to do just the classlo

Re: Clojure Performance For Expensive Algorithms

2013-02-19 Thread Geo
Thanks. The unchecked math didn't make any difference. But after I switching to aset I did indeed get to within 4x of Java. Then at the suggestion of Christophe Grand on StackOverflow I switched to .equals instead of = and that got me to ~133% of Java performance. Very close! On Tuesday, Februa

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

2013-02-19 Thread Ben Wolfson
On Tue, Feb 19, 2013 at 2:28 AM, Philip Potter wrote: > > They sound like very interesting features. They also sound lower-level > than Clojure's STM -- if a Clojure STM transaction fails, it will > automatically retry until it succeeds (or hits > LockingTransaction/RETRY_LIMIT, currently 1, w

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

2013-02-19 Thread Aaron Cohen
This is the problem that OSGI tries to address and that the long-delayed "module" system hopefully coming in JDK8 should handle (Project Jigsaw). I think currently OSGI might be your best bet if you truly need it, though there is quite a bit of work to get spun up on that. You may get lucky and b

Re: alternative to passing parameters to functions

2013-02-19 Thread Pablo Nussembaum
You can also check prismatic plumbing library where they a new function definition type based on maps. link: https://github.com/Prismatic/plumbing/tree/master/src/plumbing/fnk On 02/18/2013 05:33 AM, Gunnar Völkel wrote: > You can checkout clojure.options > (https://github.com/guv/clojure.options

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

2013-02-19 Thread Adam Clements
Thanks, I've had a look at Immutant. I don't really want to migrate my whole app to immutant's framework right now though (plus I'm just interested in how one might employ this pattern for things other than web apps too) so I've been looking through to see if I can work out how to do just the c

Clojure - CLR - JS - Visual Studio Extension

2013-02-19 Thread Eric Greene
I am interested creating an open source CLR version of Clojure which compiles to JavaScript and ultimately the creation of an open source extension for Visual Studio which provides syntax-highlighting, intellisense, automatic compilation on save, etc... of Clojure for JavaScript. Has anyone st

Re: Using local jar

2013-02-19 Thread Benjamin R. Haskell
On Sun, 17 Feb 2013, Jarod wrote: James, Aaron and Jim: thanks for your help, but it still get the old error message and another: "Leiningen managed dependencies issue: problem resolving following dependencies: [jaad/jaad "0.8.4"]".  If anyone has time, my lein version is 1.7.1 and maven versi

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

2013-02-19 Thread Philip Potter
On 18 February 2013 21:41, Tom Hall wrote: >>> 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 ar

Re: Clojure Performance For Expensive Algorithms

2013-02-19 Thread Mark Engelberg
Another idea: try using arrays of longs, rather than ints, since that is what Clojure prefers. -- -- 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 moder

Re: Using local jar

2013-02-19 Thread kiran kulkarni
Hello Jarod, I would suggest using lein-localrepoplugin. It handles all the complexity for you. Just follow the README and you will have the jar in your local repository. On Mon, Feb 18, 2013 at 1:47 AM, Jarod wrote: > James, Aaron and Jim: than