Re: Question about sets

2012-09-04 Thread Peter Taoussanis
+1 on Mark's most recent reply, that is: * Revert to 1.2 behaviour. * Consistency is good, but must be in favour of not throwing RTEs. * No knobs. It's clear that there's lots of directions that could be taken here, but getting caught up on trying to find a solution that pleases everyone 100% i

Re: Question about sets

2012-09-04 Thread Mark Engelberg
On Tue, Sep 4, 2012 at 9:30 AM, Andy Fingerhut wrote: > I'm just trying to get the argument for change as clearly as possible. > The major bullet points: 1. "It's a bug that should be fixed." The change to throw-on-duplicate behavior for sets in 1.3 was a breaking change that causes a runtime er

ANN Spyglass 1.0.2

2012-09-04 Thread Michael Klishin
Spyglass is a very fast Memcached and Couchbase client built on top of SpyMemcached. Spyglass 1.0.2 is a bug fix release: * Prevents clojurewerkz.spyglass.client from breaking namespaces that use gen-class Change log: https://github.com/clojurewerkz/spyglass/blob/1.0.x-stable/Changelog.md Docu

Re: Routing HTTP/ JSON in clojure

2012-09-04 Thread gaz jones
We do all of the things you mention (minus the replay, but that would be trivial) in Clojure where I work, and it is remarkably easy. We use: * ring + compojure and an embedded jetty server to create lightweight webservers * the Cheshire JSON encoding/decoding library for all JSON purposes (https:

Re: Question about sets

2012-09-04 Thread Herwig Hochleitner
2012/9/5 Andy Fingerhut > If someone types in the literal map {:a 5 :b 10 :c 13 :a -5}, what is the > "correct thing"? > > Some people might be thinking the correct thing is "I want the last key > :a's value, -5, to win always, no matter if the key :a occurs more than > once. I never want an err

Re: Create dynamic vars programmatically

2012-09-04 Thread Herwig Hochleitner
Beware however, that interning vars programmatically is not recommended. If you need fresh vars during runtime, use with-local-vars, which also produces dynamic vars. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

Re: Question about sets

2012-09-04 Thread Andy Fingerhut
On Sep 4, 2012, at 4:53 PM, Jim - FooBar(); wrote: > On 04/09/12 21:02, Andy Fingerhut wrote: >> >> Stuart Halloway mentioned the idea of having two kinds of set/map >> constructor functions, one kind which quietly eliminates duplicates, another >> which throws an exception on duplicates. > >

Re: Create dynamic vars programmatically

2012-09-04 Thread Herwig Hochleitner
2012/9/4 mdzaebel > (doseq [s '(a b c)] (intern *ns* s 0)) creates non-dynamic var's. > > However, how could I produce *dynamic* var's. I tried with-meta but > failed. In other words, what does (def ^:dynamic a) internally do? > You can use clojure.lang.Var.setDynamic https://github.com/clojure/

Re: Routing HTTP/ JSON in clojure

2012-09-04 Thread Russell Whitaker
On Tue, Sep 4, 2012 at 4:45 PM, David Dawson wrote: > Hiya! > > I saw the names, but then was swamped by moustache, noir and others that at > first glance appear to be in similar spaces. I found it a bit difficult to > pick out the various specialisms or layers each library is aiming at tbh. > So

Re: Question about sets

2012-09-04 Thread Jim - FooBar();
On 05/09/12 00:53, Jim - FooBar(); wrote: of course not...this also goes against set/map semantics from a mathematics point of view...the mathematical guarantees of set ('there will be no duplicates') are imposed by the set itself and not by the person/program/whatever using it! the same with

Re: Question about sets

2012-09-04 Thread Jim - FooBar();
On 04/09/12 21:02, Andy Fingerhut wrote: But what if they all consistently throw exceptions when encountering duplicates, including (set [5 5])? That doesn't sound like what you want. of course not...this also goes against set/map semantics from a mathematics point of view...the mathematical

Re: Routing HTTP/ JSON in clojure

2012-09-04 Thread David Dawson
Hiya! I saw the names, but then was swamped by moustache, noir and others that at first glance appear to be in similar spaces. I found it a bit difficult to pick out the various specialisms or layers each library is aiming at tbh. So, I thought it best to look for some guidance if possible fr

Re: Routing HTTP/ JSON in clojure

2012-09-04 Thread Russell Whitaker
On Tue, Sep 4, 2012 at 1:52 PM, David Dawson wrote: > Hiya, > > So, I'm a clojure newbie... and I've been asked to evaluate a few different > technology options for a project I've been handed. > > The end result will need to be a 'router' that accepts JSON messages over > HTTP, store them into som

Routing HTTP/ JSON in clojure

2012-09-04 Thread David Dawson
Hiya, So, I'm a clojure newbie... and I've been asked to evaluate a few different technology options for a project I've been handed. The end result will need to be a 'router' that accepts JSON messages over HTTP, store them into some datastore (ideally one of the ones available on cloudfoundry

Re: Problems with Leiningen and Clojure 1.4

2012-09-04 Thread Dimas Guardado
By the way, Lein2 uses the local maven repository to cache dependencies. You can find the clojure jar(s) used by your lein2-managaed project in ~/.m2/repository/org/clojure/clojure https://github.com/technomancy/leiningen/wiki/Upgrading (In the "Gotchas" section) On Friday, August 31, 2012 10:3

How create dynamic var programmatically

2012-09-04 Thread mdzaebel
(intern *ns* 'a 0) creates a non-dynamic var. However, how do I create a dynamic one like (def ^:dynamic a) does? -- 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 m

Create dynamic vars programmatically

2012-09-04 Thread mdzaebel
(doseq [s '(a b c)] (intern *ns* s 0)) creates non-dynamic var's. However, how could I produce *dynamic* var's. I tried with-meta but failed. In other words, what does (def ^:dynamic a) internally do? *Thanks in advance, Marc* -- You received this message because you are subscribed to the Goog

Re: Clojure on an Erlang-vm-os on Xen?

2012-09-04 Thread Rob Knight
There was an old Sun project to run the JVM directly on Xen[1] without a heavyweight OS inbetween. It looks like it never got beyond research stage, but in theory it would be possible to run Clojure on it. I'm afraid I have no idea if it actually works though! [1]: http://labs.oracle.com/proj

Re: Clojure / RootBeer / CUDA / GPU

2012-09-04 Thread Håkan Råberg
Hi Jules, I've just been hacking on OpenCL a bit the last few days[1] - Rootbeer was an inspiration after seeing it a few weeks back. I'm not trying to go down the Rootbeer route myself, but the ideas of having (cl-map f ...) is one direction one can take it. I've been mainly trying to get my h

Re: Clojure / RootBeer / CUDA / GPU

2012-09-04 Thread Håkan Råberg
Hi Jules, I've just been hacking on OpenCL a bit the last few days[1] - Rootbeer was an inspiration after seeing it a few weeks back. I'm not trying to go down the Rootbeer route myself, but the idea of having (cl-map f ...) is one direction one can take it (I've been looking a bit at Haskell's

Re: when looking for performance, consider 'cheating' !

2012-09-04 Thread Joshua Ballanco
On Mon, Sep 03, 2012 at 02:03:14PM +0100, Jim - FooBar(); wrote: > Hi all, > > this is basically a continuation of my previous thread "Functional > performance vs imperative complexity"...for those of you who are > still interested here is what I learnt during the process. I should > note that i f

Re: redefining multimethods at the repl

2012-09-04 Thread Ulises
> Binding to the var instead of the value will allow it to be udpated. Alternatively you could ns-unmap the multimethod before redefining it. U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups

[ANN] Shoreleave 0.2.2 - a library for production-ready ClojureScript

2012-09-04 Thread Paul deGrandis
Shoreleave is a collection of libraries for building robust, production-ready ClojureScript applications. It was created in parallel while making production ClojureScript applications and is running systems in the wild. Shoreleave includes: * idiomatic interfaces for browser functionality and H

Re: redefining multimethods at the repl

2012-09-04 Thread Jack Moffitt
> user=> (defmulti collide classify-colliding-things) You want (defmulti collide #'classify-colliding-things) Binding to the var instead of the value will allow it to be udpated. jack. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: redefining multimethods at the repl

2012-09-04 Thread Stephen Compall
On Tue, 2012-09-04 at 17:31 -0500, Brian Marick wrote: > user=> (defmulti collide classify-colliding-things) If you're okay with a little handwaving, how about (defmulti collide #'classify-colliding-things) Now there is no need to rerun defmulti. -- Stephen Compall "^aCollection allSatisfy: [:

Re: using take-while with pred function that has state

2012-09-04 Thread Stephen Compall
On Tue, 2012-09-04 at 15:24 -0700, Sean Corfield wrote: > But that is a hypothetical, yes? You're not suggesting that take-while > actually does that, right? Right. As of right now. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- You received this m

redefining multimethods at the repl

2012-09-04 Thread Brian Marick
I'm trying to write exercises for multimethods. Book readers will be working at the repl. Multimethods are stateful in a bad way, as shown below. Is there some sort of trick to using multimethods at the repl, or should I just give up on exercises using them? ;; Two types: user=> (defn ship [na

Re: using take-while with pred function that has state

2012-09-04 Thread Sean Corfield
On Tue, Sep 4, 2012 at 2:23 PM, Stephen Compall wrote: > On Tue, 2012-09-04 at 09:48 -0700, Sean Corfield wrote: >> Stephen, could you elaborate on this? > > Requiring pred to be free of side effects provides many invariants about > it to the `take-while' implementation; the legality of out-of-ord

Re: An instance of an abstract class in the repl?

2012-09-04 Thread Stephen Compall
On Tue, 2012-09-04 at 14:34 -0700, Mark Hamstra wrote: > What I am eventually working toward is being able to do the equivalent > to the above Scala interaction in Clojure: > > > user=> (framework-map #(+ % 1) aDataSet) > > > but as an intermediate step, I'm trying to get named function-like >

An instance of an abstract class in the repl?

2012-09-04 Thread Mark Hamstra
So I'm working on developing a Clojure api for a distributed data analysis framework. A key part of that has to be the ability to pass functions as parameters into various map, reduce, filter, groupBy, etc. functions. Since this a framework developed in Scala, these function parameters eventu

Re: using take-while with pred function that has state

2012-09-04 Thread Stephen Compall
On Tue, 2012-09-04 at 09:48 -0700, Sean Corfield wrote: > Stephen, could you elaborate on this? Requiring pred to be free of side effects provides many invariants about it to the `take-while' implementation; the legality of out-of-order calling is just one of them. > My reading of the side-effect

Re: Question about sets

2012-09-04 Thread Maik Schünemann
+1 consistency, whether it throws an exception or not, removes complexity from the language. (because the programmer don't have to know the complex rules which literal notation behaves which way On Tue, Sep 4, 2012 at 10:02 PM, Andy Fingerhut wrote: > But what if they all consistently throw excep

Re: Question about sets

2012-09-04 Thread Andy Fingerhut
But what if they all consistently throw exceptions when encountering duplicates, including (set [5 5])? That doesn't sound like what you want. Also, it seems from this discussion that at least some people like the error-catching aspects of the current behavior. Stuart Halloway mentioned the id

ANN: Ragtime 0.3.0

2012-09-04 Thread James Reeves
I've recently released Ragtime 0.3.0, a library for managing migrations. I've been working on it on-and-off for a while, and it's now ready for more general use. Ragtime abstracts migrations in the same way that Ring abstracts web applications. Ragtime doesn't specify how migrations are generated

[ANN] clojure-encog has a new name and repo

2012-09-04 Thread Jim - FooBar();
Hi all, just wanted to let you know that I renamed 'clojure-encog' to *enclog* ...release 0.5.0 does not add anything but several 'library coding standards' that i was previously not aware of, have been addressed... I created a brand new repo here : https://github.com/jimpil/enclog and a new

Re: Question about sets

2012-09-04 Thread Jim - FooBar();
the issue here is that behaviour should be *consistent* across all forms of ctor functions, so programmers don't have to remember which one allows what or don't thus limiting code breaks...the literal syntax is just too elegant to give up! I don't think anyone is against consistency... Jim ps

Re: using take-while with pred function that has state

2012-09-04 Thread Sean Corfield
On Mon, Sep 3, 2012 at 1:58 PM, Stephen Compall wrote: > On Sun, 2012-09-02 at 23:02 -0700, Ben Wolfson wrote: >> Can you say what this means (the note about take-while being called in >> coll order)? >> >> Does it mean that it's not a guarantee of the API that the predicate >> passed to take-whil

Re: Question about sets

2012-09-04 Thread Andy Fingerhut
I have created a dev page for this issue. It isn't a JIRA ticket because it isn't clear to me yet exactly what the changes should be. http://dev.clojure.org/display/design/Allow+duplicate+map+keys+and+set+elements A couple of questions there for people that dislike the current behavior. You ca

ANN lein-set-version 0.2.0

2012-09-04 Thread Hugo Duncan
lein-set-version is a Leiningen plugin to update your project version. Apart from updating project.clj, you can configure the update of other project files, such as the README. lein-set-version also updates versions of sub-projects in :dependencies when run with lein-sub. Usage and configuratio

ANN Pallet 0.7.2

2012-09-04 Thread Hugo Duncan
Pallet is a library for infrastructure management, covering provisioning, configuration management and deployment. Pallet 0.7.2 is mainly a bug fix release. It addresses a number of issues around the usage of the lein plugin which were causing problems for some people following the first steps in

Re: reporting function inputs as part of exceptions

2012-09-04 Thread Jim - FooBar();
You want this on every single fn you define? in this case, yes you would need a tweaked 'defn' form...something like this perhaps: (defmacro defn-capt [name [& args] & code] `(defn ~name [~@args] (try ~@code (catch Exception e# {:exception e# :origin ~name

multimethod table watch ?

2012-09-04 Thread ollem
I'm looking for a way to get notified when a new method of multimethod is installed and associated with a new dispatch function, kind of like the add-watch function. Are there any ways of achieving this without polling with clojure.core/methods ? -- You received this message because you are su

Re: Found bug in contains? used with vectors.

2012-09-04 Thread Ben Smith-Mannschott
The naming of contains? is one of Clojure's small warts. Almost everyone seems to stumble over it when they're starting out. I know I did. Naming it contains-key? would have prevented a great deal of confusion, but I guess that ship has sailed... *shrug* // ben On Tue, Sep 4, 2012 at 1:35 PM, Jim

Re: Found bug in contains? used with vectors.

2012-09-04 Thread Jim - FooBar();
personally I've gotten used to it but it seems that every couple of weeks someone else will be confused and try to use contains? as it would be used in Java...the docs are clear but unfortunately not everyone consults the docs beforehand! at least not for such a semantically clear name as "cont

Re: reporting function inputs as part of exceptions

2012-09-04 Thread Jim - FooBar();
I'm so sorry... this one works! (defmacro capture-inputs [f & args] `(try (~f ~@args) (catch Exception e# (do (println "oops!") {:e e# :inputs (vector ~@args)} Jim On 04/09/12 12:23, Jim - FooBar(); wrote: oops gensym mistake! (defmacro capture-inputs [f & args] `(try (apply ~f ~@ar

Re: reporting function inputs as part of exceptions

2012-09-04 Thread Jim - FooBar();
oops gensym mistake! (defmacro capture-inputs [f & args] `(try (apply ~f ~@args) (catch Exception e# (do (println "oops!") {:e e# :inputs (vec ~args)} Jim On 04/09/12 12:20, Jim - FooBar(); wrote: you want the exception thrown to report the arguments or 'capture them' (as you say)

London Clojure Dojo 11 September

2012-09-04 Thread Bruce Durling
Fellow Clojurians, To those of you who have shown restraint and allowed others to sign up to the dojo on 11 September at Forward I extend my heartfelt thanks. :-D I think everyone has been given enough time to sign up and come to the dojo. There are still plenty of places left. The sign up is he

Re: reporting function inputs as part of exceptions

2012-09-04 Thread Jim - FooBar();
you want the exception thrown to report the arguments or 'capture them' (as you say) in the actual Exception object so you can use them outside the try-catch scope? the former is very straight forward you just use your arguments...the latter is more fuss as you have to gen-class your own except

Re: Question about sets

2012-09-04 Thread Jim - FooBar();
On 04/09/12 02:06, Mark Engelberg wrote: This email is also my way of bumping the thread and bringing it again to everyone's attention. This is something I'd very much like to see resolved. +1 ... this thread should not die! Jim -- You received this message because you are subscribed to the

Re: genuine help needed to speed up minimax algorithm!

2012-09-04 Thread Jim - FooBar();
everything is working fine...see the post from yesterday called 'when looking for performance consider cheating' for an up to date explanation of how and where i cheated to speed it up... Jim On 04/09/12 04:42, Bill Robertson wrote: Did you figure out what was going on? -- You received this m

Re: Found bug in contains? used with vectors.

2012-09-04 Thread dmirylenka
Instead of (let [predicate #(contains? (set unselect) %1)] ...) I would write (let [predicate (set unselect)] ...) On Tuesday, September 4, 2012 11:10:04 AM UTC+2, Marcus Lindner wrote: > > I wanted to use it to select a random element in a collection (set, > vector or list) where I can define

Re: Found bug in contains? used with vectors.

2012-09-04 Thread Marcus Lindner
I wanted to use it to select a random element in a collection (set, vector or list) where I can define elements which should not be selected. The function I now use is: (defn select-random [collection & unselect] "(select-random collection & unselect) selects a random element from the specifi

Re: Found bug in contains? used with vectors.

2012-09-04 Thread Marcus Lindner
I think this is not a bad idea. ;) At all, a method/function name should describe what it does. And if 'contains?' only looks for keys, then 'contains-key?' would be a better descriptor for it. Am 03.09.2012 13:29, schrieb Jim - FooBar();: this is probably the single most confusing name in cl