Re: Found bug in contains? used with vectors.

2012-09-03 Thread dmirylenka
As for contains? behavior on lists, it is fixed (CLJ-932) in Clojure 1.5, some 17 days ago: => (contains? '(1 2 3) 2); IllegalArgumentException contains? not supported on type: clojure.lang.PersistentList ...

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

2012-09-03 Thread Ben Wolfson
On Mon, Sep 3, 2012 at 10:36 PM, Aaron Cohen wrote: > > It wouldn't even be all that insane if you had 1000 otherwise idle > cores sitting around and an expensive enough predicate. Touché (perhaps up to a factor of n). (Though I suspect you need more assumptions given that the specific algorithm

Re: reporting function inputs as part of exceptions

2012-09-03 Thread Alan Malloy
Slingshot's throw+ generates an exception object that includes, among other things, all the locals in the context of your throw. On Monday, September 3, 2012 9:03:42 PM UTC-7, Timothy Pratley wrote: > > I'm working on a project where it would be quite convenient to have the > input values to the

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

2012-09-03 Thread Aaron Cohen
On Tue, Sep 4, 2012 at 1:24 AM, Ben Wolfson wrote: > On Mon, Sep 3, 2012 at 1:58 PM, Stephen Compall > wrote: > Of course take-while might cause more of a lazy seq to be realized > than is present in its output because of seq chunking. But I'd *hope* > that it wouldn't exacerbate that by reservin

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

2012-09-03 Thread Ben Wolfson
On Mon, Sep 3, 2012 at 1:58 PM, Stephen Compall wrote: >> I would have hoped that would be guaranteed > > Nevertheless, by declaring "pred must be free of side-effects", > `take-while' is refusing to make that promise, among many others. It seems like a leap to go from pred being free of side-eff

clj-logging-config, lein2 and AOT compilation == NullPointerException

2012-09-03 Thread Leonardo Borges
Hi all, I've been debugging an issue in my Clojure app deployed on Heroku and after some time I finally tracked it down to what appears to be an issue when AOT compiling the project while using clj-logging-config [1] It works without any issues if I let Clojure compile my namespaces on the fly. A

reporting function inputs as part of exceptions

2012-09-03 Thread Timothy Pratley
I'm working on a project where it would be quite convenient to have the input values to the function reported in any exceptions that get thrown. I'm guessing the way to do this would be to create a replacement defn which had a try catch and threw a new error with the inputs captured. Has anyone

Re: genuine help needed to speed up minimax algorithm!

2012-09-03 Thread Bill Robertson
Did you figure out what was going on? -- 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 moderated - please be patient with your first post. To unsubscrib

Re: Question about sets

2012-09-03 Thread Sean Corfield
On Mon, Sep 3, 2012 at 6:06 PM, Mark Engelberg wrote: > I don't know what the path is now. I feel that in the past year, there have > been several times where people have raised meaningful issues about Clojure > and received no official response. It's hard to know whether this is an > intentiona

Re: clojure.org/getting_started: not up to date

2012-09-03 Thread gaz jones
I've been playing with Go a lot recently, and I have found the documentation / new user experience very good: http://golang.org/ On Mon, Sep 3, 2012 at 2:19 PM, Denis Labaye wrote: > > > On Mon, Sep 3, 2012 at 5:40 PM, Softaddicts > wrote: >> >> Btwy, using leiningen's repl hides all these i

Re: Question about sets

2012-09-03 Thread Mark Engelberg
In the early days of Clojure, it was clear that Rich was reading every post on the Clojure mailing list. He didn't respond to every single thread, of course, but when new issues were raised, he would frequently chime in, "That's a good point, please create a patch for that" or "That's something th

Re: Reflecting over protocols in macros for clojurescript

2012-09-03 Thread Ceri Storey
2012/9/3 David Nolen > On Mon, Sep 3, 2012 at 5:57 PM, Ceri Storey wrote: > > Okay--I'd missed that the information gets recorded in the namespaces > var in > > cljs.analyse, so I think that I shoudl be able to do what I want with a > > combination of cljs.analyse/resolve-var , get-namespaces, a

Re: Reflecting over protocols in macros for clojurescript

2012-09-03 Thread David Nolen
On Mon, Sep 3, 2012 at 5:57 PM, Ceri Storey wrote: > Okay--I'd missed that the information gets recorded in the namespaces var in > cljs.analyse, so I think that I shoudl be able to do what I want with a > combination of cljs.analyse/resolve-var , get-namespaces, and inspecting the > results. Is t

Re: Reflecting over protocols in macros for clojurescript

2012-09-03 Thread Ceri Storey
2012年9月3日月曜日 16時54分34秒 UTC+1 David Nolen: > > On Mon, Sep 3, 2012 at 5:20 AM, Ceri Storey > > wrote: > > Are you referring to the ability when using Clojure on the JVM to get > the map of data from referencing the protocol itself? > I did not even know you could do that, but that does look l

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

2012-09-03 Thread Stephen Compall
On Mon, 2012-09-03 at 01:12 -0700, Alan Malloy wrote: > (map #(do %2 %1) c1 c2) is a neat trick I hadn't seen in this context; > thanks for showing me! Perhaps you'd also like to advocate for the inclusion of `first-arg', which has several other uses, in core? :) -- Stephen Compall ^aCollection

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

2012-09-03 Thread Stephen Compall
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-while be called *successively* on the items in the > collection pa

Re: webnoir on openshift (Paas by RedHat), little guide

2012-09-03 Thread Simone Mosciatti
Yes, I know it is an issue, but I didn't really find any other PaaS (free to start) without such problem... On Monday, September 3, 2012 3:21:02 AM UTC+2, raould wrote: > > now if only they had a webinar that explained the utterly horrendous > leagaleze nightmare tolsoty-length terms and conditi

Re: clojure.org/getting_started: not up to date

2012-09-03 Thread Denis Labaye
On Mon, Sep 3, 2012 at 5:40 PM, Softaddicts wrote: > Btwy, using leiningen's repl hides all these issues... > yes, and Emacs is one of the best for hacking Clojure code ... But not necessarily for new users, who don't know Emacs or Java. And even better than lein: You can't beat an online REPL f

Re: Protocol methods, name shadowing and dot notation

2012-09-03 Thread Víctor M . V .
Oh, I understand. Works in ClojureScript as well! I noticed that in this line (protocols/get [_] 42) One can safely drop the namespace qualification. Thank you very much Matthias - this issue was certainly a blocker for me. On Mon, Sep 3, 2012 at 5:54 PM, Matthias Benkard wrote: > You have re

Re: I want to know how can I run it?

2012-09-03 Thread John Gabriele
On Monday, September 3, 2012 11:34:02 AM UTC-4, John Gabriele wrote: > > On Thursday, August 30, 2012 9:36:14 PM UTC-4, gearss wrote: >> >> I have a file named pong.clj, it isunder following, I want to know how >> can I run it? >> Thank you. >> >> > > Hi gearss. See "Launching a Script" at http:

Re: Protocol methods, name shadowing and dot notation

2012-09-03 Thread Matthias Benkard
You have reused a name already bound in the `protocols` namespace. You cannot bind two things to the same var. On the other hand, precisely because namespaces are not complected with protocol dispatch, you can easily free the `get` identifier for your purposes by doing exactly what you would do

Re: Reflecting over protocols in macros for clojurescript

2012-09-03 Thread David Nolen
On Mon, Sep 3, 2012 at 5:20 AM, Ceri Storey wrote: > Hi there. > > I'm having a play around with ClojureScript, and I'd find it really useful > to be able to be able to create some Mockito style test spies. Ultimately, > I'd like to be able to generate a spie by reflecting over a protocol and > fi

Re: clojure.org/getting_started: not up to date

2012-09-03 Thread Softaddicts
Btwy, using leiningen's repl hides all these issues... Luc > This will work only if > > A) there is a manifest in the jar specifying which class contains the main > method > > B) if you do not need to add libraries explicitly, -cp is ignored when you use > -jar > > Clojure.org is correc

Re: I want to know how can I run it?

2012-09-03 Thread John Gabriele
On Thursday, August 30, 2012 9:36:14 PM UTC-4, gearss wrote: > > I have a file named pong.clj, it isunder following, I want to know how can > I run it? > Thank you. > > Hi gearss. See "Launching a Script" at http://clojure.org/repl_and_main . ---John -- You received this message because you

Re: ANN: ClojureSphere updated

2012-09-03 Thread Marco Dalla Stella
2012/9/3 Justin Kramer : > ClojureSphere has been updated with a new domain, refreshed index, and some > new features: > > http://www.clojuresphere.com/ Awesome work! Kudos, -- Marco Dalla Stella web: http://marco.dallastella.name twitter: http://twitter.com/mdallastella -- You received this m

Re: Protocol methods, name shadowing and dot notation

2012-09-03 Thread vemv
Hi Matthias, I can't disagree with you, and am open to change my mind. Just a question. Given again this example: (ns protocols) (defprotocol P (get [_])) (ns app) (defrecord R [] protocols/P (get [_] 42)) (can you call R's get without resorting to dot-notation, this is, with a na

Re: clojure.org/getting_started: not up to date

2012-09-03 Thread Softaddicts
This will work only if A) there is a manifest in the jar specifying which class contains the main method B) if you do not need to add libraries explicitly, -cp is ignored when you use -jar Clojure.org is correct, especially regarding b). If you happen to need to add libs to your REPL, -jar

Re: ANN: ClojureSphere updated

2012-09-03 Thread Justin Kramer
Michael, I actually think it's a project.clj parsing issue. Midje's is a little non-standard looking. I've opened an issue for it. Thanks for the feedback and report, Justin On Monday, September 3, 2012 2:15:28 AM UTC-4, Michael Klishin wrote: > > 2012/9/3 Justin Kramer > > >> ClojureSphere ha

Re: Protocol methods, name shadowing and dot notation

2012-09-03 Thread vemv
Would it be feasible to efficiently make them first class? Surely this isn't a new question, as many would desire to write (mapv .toString (range 10)) rather than (mapv #(.toString %) (range 10)). Couldn't find info on that topic... *(just an example, I know there's str) On Monday, September 3

Re: Protocol methods, name shadowing and dot notation

2012-09-03 Thread Matthias Benkard
Hi, In principle, dispatch is orthogonal to namespacing. It is true that traditional OO systems complect these two things, but there is no inherent need to do so. Separating dispatch (i.e., methods) from namespacing is simpler and more flexible. This is especially useful when you have multip

Re: Protocol methods, name shadowing and dot notation

2012-09-03 Thread Ambrose Bonnaire-Sergeant
On Mon, Sep 3, 2012 at 9:17 PM, vemv wrote: > At least from the point of view of someone that isn't too familiar with > the Clojure internals, I see no downsides - although I tried it! For > instance, given that one can call (.first ()), I thought that then one > could call (.first (ARecord.)), w

Re: Protocol methods, name shadowing and dot notation

2012-09-03 Thread vemv
Correction: records/types actually include plenty of dot-accesible methods, though less than lists -for instance- do. (mapv println (.getMethods (.getClass (ARecord. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send em

Protocol methods, name shadowing and dot notation

2012-09-03 Thread vemv
Hello there, I'm not quite sure whether is convenient for each method implementation to possibly shadow previous names, particularly those of clojure.core. (defprotocol Example (get [this])) The previous example redefines get in the current namespace. But is that we usually mean by "me

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

2012-09-03 Thread Dave Sann
I have used the following (from a bunch of utils I have for seqs) in the past to do this kind of thing. You will need to define the reduce-fn and the predicate you need. examples below in the comment. (defn take-while-reduce "fancy take accumulating a reduced value on taken items this va

when looking for performance, consider 'cheating' !

2012-09-03 Thread Jim - FooBar();
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 finally got the performance I was after without sacrificing any immutabil

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

2012-09-03 Thread Dave Sann
I have used the following in the past in some utils I have for seqs: (defn take-while-reduce "fancy take accumulating a reduced value on taken items this value can then be tested in the take fn e.g (take-while-reduce 0 (fn [v i] (inc v)) (fn [v i] (= v i))

Re: Found bug in contains? used with vectors.

2012-09-03 Thread greg r
You could try the function some. => (some #{3} [1 2 3]) 3 => (some #{3} [1 2 5]) nil This uses a set as a predicate function. Greg On Monday, September 3, 2012 7:03:07 AM UTC-4, Goldritter wrote: > > I use Clojure 1.4.0 and wanted to use 'contains?' on a vector and get > following results: > >

Re: Found bug in contains? used with vectors.

2012-09-03 Thread Jim - FooBar();
this is probably the single most confusing name in clojure! :-) why can't we make it "contains-key?" ? Jim On 03/09/12 12:14, Goldritter wrote: Ah ok. So I need to transform a vector and/or a list into a set first. Thanks. Am Montag, 3. September 2012 13:05:52 UTC+2 schrieb Ambrose Bonnaire-

Re: Found bug in contains? used with vectors.

2012-09-03 Thread Tassilo Horn
Goldritter writes: > Ah ok. So I need to transform a vector and/or a list into a set first. No, not really. All clojure collections implement java.util.Collection, so you can always use (.contains your-coll something) to check if your-coll contains something. However, keep in mind that thi

Re: Found bug in contains? used with vectors.

2012-09-03 Thread Goldritter
Ah ok. So I need to transform a vector and/or a list into a set first. Thanks. Am Montag, 3. September 2012 13:05:52 UTC+2 schrieb Ambrose Bonnaire-Sergeant: > > 'contains?' tests if a key is in a collection. > > Vector is an associative data structure, with keys being indexes. > A vector of len

Re: Found bug in contains? used with vectors.

2012-09-03 Thread Mayank Jain
>From the book Clojure Programming , Page 101 : *"It is a common mistake for Clojure programmers to initially believe that > contains? always searches for the presence of a value in a collection, that > is, that it would be appropriate to use to determine if the vector

Re: Found bug in contains? used with vectors.

2012-09-03 Thread Ambrose Bonnaire-Sergeant
'contains?' tests if a key is in a collection. Vector is an associative data structure, with keys being indexes. A vector of length 3 has the key 2, but not key 3. Thanks, Ambrose On Mon, Sep 3, 2012 at 7:03 PM, Goldritter < marcus.goldritter.lind...@googlemail.com> wrote: > I use Clojure 1.4.0

Found bug in contains? used with vectors.

2012-09-03 Thread Goldritter
I use Clojure 1.4.0 and wanted to use 'contains?' on a vector and get following results: => (contains? [1 2 3] 3) false => (contains? [1 2 3] 2) true As it seems 'contains?' does not check for the last entry in the vector. And an other question. Why does contains? returns everytime 'false' when

Re: Reflecting over protocols in macros for clojurescript

2012-09-03 Thread Ceri Storey
(with apologies for the accidental double posting). 2012/9/3 Ceri Storey > Hi there. > > I'm having a play around with ClojureScript, and I'd find it really useful > to be able to be able to create some Mockito style test spies. Ultimately, > I'd like to be able to generate a spie by reflecting

Re: anonymous functions with names

2012-09-03 Thread Mayank Jain
@dmirylenka Thanks. That is useful to know. On Mon, Sep 3, 2012 at 3:00 PM, dmirylenka wrote: > Just 2 cents: > > A name you give to the anonymous function also appears in the stack traces > instead of the things like fn_123_4532, > which is very convenient for debugging. > > On Friday, August 31

Re: anonymous functions with names

2012-09-03 Thread Stathis Sideris
Thanks, this is a *very* useful bit of information. On Monday, 3 September 2012 10:30:21 UTC+1, dmirylenka wrote: > > Just 2 cents: > > A name you give to the anonymous function also appears in the stack traces > instead of the things like fn_123_4532, > which is very convenient for debugging. >

Re: anonymous functions with names

2012-09-03 Thread dmirylenka
Just 2 cents: A name you give to the anonymous function also appears in the stack traces instead of the things like fn_123_4532, which is very convenient for debugging. On Friday, August 31, 2012 5:52:55 PM UTC+2, Erlis Vidal wrote: > > Hi guys, > > I've been reading but I'm still confused abou

Reflecting over protocols in macros for clojurescript

2012-09-03 Thread Ceri Storey
Hi there. I'm having a play around with ClojureScript, and I'd find it really useful to be able to be able to create some Mockito style test spies. Ultimately, I'd like to be able to generate a spie by reflecting over a protocol and find out what operations it supports programatically. However, no

Re: Why IPersistentList doesn't extend ISeq?

2012-09-03 Thread Andrei Zhlobich
I know it :) Actually clojure has 3 implementations of IPersistentCollection: 1) PersistentList - it is already ISeq 2) EmptyList - it is ISeq (!) https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentList.java#L129 3) PersistentQueue - semantically it it not a list Empty

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

2012-09-03 Thread Alan Malloy
(map #(do %2 %1) c1 c2) is a neat trick I hadn't seen in this context; thanks for showing me! On Sunday, September 2, 2012 10:26:07 PM UTC-7, Stephen Compall wrote: > > On Fri, 2012-08-31 at 05:08 -0700, shaobohou wrote: > > I have written the following function using take-while and a pred > >

Re: Why IPersistentList doesn't extend ISeq?

2012-09-03 Thread Andrei Zhlobich
At this time empty list is a valid seq. user => (list? ()) true Sources: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentList.java#L129 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: Possible to merge destructuring :or defaults with :as?

2012-09-03 Thread Gunnar Völkel
In case you are primarily interested in clojure functions with keyword arguments (or "optional arguments"), you might check if clojure.options (https://github.com/guv/clojure.options/) suits you. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To po

Re: screencast corruption

2012-09-03 Thread Mayank Jain
@Ben Thank you for uploading. Will check it out. On Mon, Sep 3, 2012 at 1:13 AM, Ben Smith-Mannschott wrote: > You should be able to download it from here for the next few days: > > https://dl.dropbox.com/u/8238674/clojure-sequences.mov > > // Ben > > On Sun, Sep 2, 2012 at 6:56 PM, Andrew Rafas

clojure.org/getting_started: not up to date

2012-09-03 Thread Denis Labaye
On http://clojure.org/getting_started: Download and unzip Clojure. In the directory in which you expanded clojure.zip, run: java -cp clojure-1.4.0.jar clojure.main Should be just: java -jar clojure-1.4.0.jar It's a detail, but an important one, as it's the fir

Re: I want to know how can I run it?

2012-09-03 Thread Denis Labaye
1. java -cp ./org/clojure/clojure/1.4.0/clojure-1.4.0.jar clojure.main 2. cut & paste your code in the REPL 3. type (start) [enter] On Fri, Aug 31, 2012 at 3:36 AM, gearss wrote: > I have a file named pong.clj, it isunder following, I want to know how can > I run it? > Thank you. > >