Re: Let's see how fast we can make this

2010-12-23 Thread Alan Busby
Hi All, On Fri, Dec 24, 2010 at 4:32 PM, Meikel Brandmeyer wrote: > Most interesting is also the relation between the different versions on the > given machine. Just the numbers of one algorithm aren't really comparable, I > guess. (different machine, different load, different phase of moon, wh

Re: Let's see how fast we can make this

2010-12-23 Thread Meikel Brandmeyer
Hi, Am 24.12.2010 um 02:08 schrieb Ken Wesson: > It's also possible that -server vs. -client is an issue here, also > running it a few times in a row so JIT will have kicked in. I used > -server and ran each test a few times until the numbers settled down > before posting my timings here; I'm not

Re: My first Clojure program: request for code review

2010-12-23 Thread Ken Wesson
On Fri, Dec 24, 2010 at 12:06 AM, Benny Tsai wrote: >> You're welcome. Sorry I couldn't be of greater help. If you want, I >> could throw together a quickie macro for grabbing a few items from >> either end of a seq. > Sure, that would be cool :) OK, here goes ... (defmacro ends [[[firsts mid la

Re: My first Clojure program: request for code review

2010-12-23 Thread Benny Tsai
Sure, that would be cool :) Sorry for the hijack, Marek! On Dec 23, 5:09 pm, Ken Wesson wrote: > On Thu, Dec 23, 2010 at 7:08 PM, Benny Tsai wrote: > > On Dec 22, 11:42 am, Ken Wesson wrote: > >> I don't think Clojure has that. Closest is > > >> (let [[f & rst] [1 2 3 4 5] > >>       l (last r

pods?

2010-12-23 Thread Seth
I am interested in the references to pods that are floating around the internet. However, when i downloaded the github master repository, i couldn't find pod anywhere. Of course there are 17 other branches... Clojures support for mutable multithreading is great if there are no side effects, but som

Re: My first Clojure program: request for code review

2010-12-23 Thread Ken Wesson
On Thu, Dec 23, 2010 at 7:08 PM, Benny Tsai wrote: > On Dec 22, 11:42 am, Ken Wesson wrote: >> I don't think Clojure has that. Closest is >> >> (let [[f & rst] [1 2 3 4 5] >>       l (last rst) >>       m (butlast rst)] >>   [f m l]) >> >> Output is [1 (2 3 4) 5] >> >> Obviously, using the last e

Re: Let's see how fast we can make this

2010-12-23 Thread Ken Wesson
On Thu, Dec 23, 2010 at 5:10 PM, Sean Corfield wrote: > On Thu, Dec 23, 2010 at 12:31 PM, Mark Engelberg > wrote: >> Any ideas why people are getting such radically different results on >> their machines?  It's hard for library writers to write any kind of >> optimized code if "optimized" on one

Re: My first Clojure program: request for code review

2010-12-23 Thread Benny Tsai
On Dec 22, 11:42 am, Ken Wesson wrote: > I don't think Clojure has that. Closest is > > (let [[f & rst] [1 2 3 4 5] >       l (last rst) >       m (butlast rst)] >   [f m l]) > > Output is [1 (2 3 4) 5] > > Obviously, using the last element is non-lazy. It may well be that in > cases where you'd w

Re: My first Clojure program: request for code review

2010-12-23 Thread Benny Tsai
Neat trick! Thanks David :) On Dec 22, 11:23 am, David Nolen wrote: > On Wed, Dec 22, 2010 at 1:22 PM, David Nolen wrote: > > On Wed, Dec 22, 2010 at 1:14 PM, Benny Tsai wrote: > > >> Hi Ken, > > >> > user=> (let [[x y & more] [1 2 3 4 5]] [x y more]) > >> > [1 2 (3 4 5)] > >> > user=> (let [[

Re: Public mutable fields in deftype

2010-12-23 Thread Alex Miller
I think that's an even more opinionated "no". :) On Dec 23, 4:54 pm, "nicolas.o...@gmail.com" wrote: > On Thu, Dec 23, 2010 at 10:29 PM, Meikel Brandmeyer wrote: > > Hi, > > > Am 23.12.2010 um 23:15 schrieb nicolas.o...@gmail.com: > > >> If I were to write such a patch, would it be accepted? > >

Re: Public mutable fields in deftype

2010-12-23 Thread nicolas.o...@gmail.com
On Thu, Dec 23, 2010 at 10:29 PM, Meikel Brandmeyer wrote: > Hi, > > Am 23.12.2010 um 23:15 schrieb nicolas.o...@gmail.com: > >> If I were to write such a patch, would it be accepted? > > I lean now quite a bit out the window, but I dare say: „No.“ The reason I > think so is that this is opiniona

Re: get the total memory used by a data structure?

2010-12-23 Thread Daniel Janus
On 23 Gru, 05:51, Robert McIntyre wrote: > I think it would be really cool to have a function that gives the > total number of bytes that a data structure consumes. Here is a tiny utility I wrote some time ago; it's not very accurate, but might come in handy: https://gist.github.com/417669 bes

Re: Public mutable fields in deftype

2010-12-23 Thread Meikel Brandmeyer
Hi, Am 23.12.2010 um 23:15 schrieb nicolas.o...@gmail.com: > If I were to write such a patch, would it be accepted? I lean now quite a bit out the window, but I dare say: „No.“ The reason I think so is that this is opinionated. Sincerely Meikel -- You received this message because you are su

Re: Public mutable fields in deftype

2010-12-23 Thread nicolas.o...@gmail.com
On Thu, Dec 23, 2010 at 9:28 PM, Meikel Brandmeyer wrote: > Hi, > > Am 23.12.2010 um 15:26 schrieb nicolas.o...@gmail.com: > >> Is there a way to make some mutable fields public in a deftype? > > I think it is opinionated, that this is not possible as the documentation > states explicitly that th

Re: Let's see how fast we can make this

2010-12-23 Thread Sean Corfield
On Thu, Dec 23, 2010 at 12:31 PM, Mark Engelberg wrote: > Any ideas why people are getting such radically different results on > their machines?  It's hard for library writers to write any kind of > optimized code if "optimized" on one machine means "slower" on > another. FWIW, I've experienced r

Re: Public mutable fields in deftype

2010-12-23 Thread Meikel Brandmeyer
Hi, Am 23.12.2010 um 15:26 schrieb nicolas.o...@gmail.com: > Is there a way to make some mutable fields public in a deftype? I think it is opinionated, that this is not possible as the documentation states explicitly that the fields will be private when made mutable. You could write a special

Re: "classic" clojure-contrib 1.3.0-alpha4 released

2010-12-23 Thread Meikel Brandmeyer
Hi, Am 23.12.2010 um 00:08 schrieb Stuart Halloway: > Nothing about multiple small bundles prevents doing a bigger bundled release > as well. There continues to be a "kitchen sink" contrib, and there can be a > "batteries included" build of the newer libs too. Repositories are orthogonal > to

Re: Let's see how fast we can make this

2010-12-23 Thread Mark Engelberg
Any ideas why people are getting such radically different results on their machines? It's hard for library writers to write any kind of optimized code if "optimized" on one machine means "slower" on another. -- You received this message because you are subscribed to the Google Groups "Clojure" g

Re: Funding 2011?

2010-12-23 Thread Mark Engelberg
To motivate contributors, I'd recommend that now would be a great time for someone on the clojure/core team to post a summary of the highlights of what has been accomplished this year, and some of the key things on the agenda for next year. -- You received this message because you are subscribed

Re: Let's see how fast we can make this

2010-12-23 Thread David Nolen
On Thu, Dec 23, 2010 at 3:03 PM, Remco van 't Veer wrote: > On my system it is about 10x faster than the code in the original > thread. Together with the amount of time saved writing it, it's full > seconds, maybe even minutes faster! I guess your nanoseconds and are > not my nanoseconds.. ;)

Re: dispatching on a resulting range

2010-12-23 Thread David Nolen
On Wed, Dec 22, 2010 at 9:40 PM, Alex Baranosky < alexander.barano...@gmail.com> wrote: > Hi > > I've been playing with multimethods, and trying to see if there was a way > to dispatch on a non-specific result of the dispatching function, such as a > range, like this: > > (defn how-to-move [map1 m

Re: Let's see how fast we can make this

2010-12-23 Thread Remco van 't Veer
On 2010/12/23 18:30, Ken Wesson wrote: > On Thu, Dec 23, 2010 at 3:24 AM, Remco van 't Veer wrote: >> Simpler and faster: >> >>  (count (clojure.string/replace s " " "")) > > Simpler, yes, but not at all faster: > > Time (in nanoseconds): 120485.9396 > > This is about comparable to the slow, unop

Re: dispatching on a resulting range

2010-12-23 Thread Alyssa Kwan
I completely disagree. If arbitrary load order were sufficient, there wouldn't be (prefer-method). (And CL wouldn't have a complex heuristic for ordering.) In reality, you may be extending someone else's library by calling (defmethod) on their (defmulti). And you could be using someone else's l

Re: dispatching on a resulting range

2010-12-23 Thread Ken Wesson
On Thu, Dec 23, 2010 at 1:37 PM, Jay Fields wrote: > 2010/12/23 Ken Wesson  >> >> It most certainly is not. > > Yes, it is. Is not! >> Unlike cond clauses, methods might be >> scattered in different parts of a large code base > > _might_ be. But they don't need to be. It suffices for my argumen

Re: dispatching on a resulting range

2010-12-23 Thread Jay Fields
2010/12/23 Ken Wesson > It most certainly is not. > Yes, it is. > Unlike cond clauses, methods might be > scattered in different parts of a large code base _might_ be. But they don't need to be. I'd rather group my methods, know what I'm doing, and have to configure less. Anything that requi

Re: Let's see how fast we can make this

2010-12-23 Thread David Nolen
(set! *unchecked-math* true) (defn count-num-chars ^long [^String s] (let [l (.length s) c \space] (loop [i 0 acc 0] (if (< i l) (recur (inc i) (if (identical? (.charAt s i) c) acc (inc acc))) acc Clojure 1.3.0-master-SNAPSH

Re: Calling methods with a dollar sign in them

2010-12-23 Thread Sean Corfield
On Thu, Dec 23, 2010 at 5:13 AM, Jay Fields wrote: > (Outer$Inner.) currently works as long as you (ns foo (:import [bar > Outer$Inner])) Ah, good to know. I didn't actually have a test case handy - I just wondered how Clojure handled $ in such symbol names, give the OP comment. -- Sean A Corfi

Re: Let's see how fast we can make this

2010-12-23 Thread Ken Wesson
On Thu, Dec 23, 2010 at 3:24 AM, Remco van 't Veer wrote: > Simpler and faster: > >  (count (clojure.string/replace s " " "")) Simpler, yes, but not at all faster: Time (in nanoseconds): 120485.9396 This is about comparable to the slow, unoptimized loop posted at the start of this thread. Frank

Re: dispatching on a resulting range

2010-12-23 Thread Ken Wesson
On Thu, Dec 23, 2010 at 8:51 AM, Jay Fields wrote: > Ken said: > "That seems sucky. What about adding a priority parameter to your > defmethod-analogue? The predicates are kept sorted by priority." > I disagree. To use your terms, I think your solution is equally "sucky". It most certainly is not

Re: Out of memory

2010-12-23 Thread David Nolen
On Thu, Dec 23, 2010 at 11:29 AM, Paul Mooser wrote: > So, doesn't this represent a bug at least ? I'm sometimes confused > when this sort of issue doesn't get more attention, and I'm uncertain > what the process is for filing a bug, since my impression is that we > are supposed to have issues va

Re: Out of memory

2010-12-23 Thread Paul Mooser
So, doesn't this represent a bug at least ? I'm sometimes confused when this sort of issue doesn't get more attention, and I'm uncertain what the process is for filing a bug, since my impression is that we are supposed to have issues validated by discussion on the group before filing an actual tic

Re: Cannot recur across try

2010-12-23 Thread Amitava Shee
On Dec 23, 10:41 am, David Nolen wrote: > I would ping the devs of cake and make sure that they are aware of the > issue. > > David Did so already - http://groups.google.com/group/clojure-cake/browse_thread/thread/addf355043dcc2d7 Amitava -- You received this message because you are subscribe

Re: Cannot recur across try

2010-12-23 Thread David Nolen
On Thu, Dec 23, 2010 at 10:33 AM, Amitava Shee wrote: > > > I don't know the details, but the ticket is here: > > > > http://dev.clojure.org/jira/browse/CLJ-31?page=com.atlassian.jira.plu... > > > > Perhaps better if the REPL caught exceptions in the manner that Clojure's > > REPL does: > > > > ht

Re: Cannot recur across try

2010-12-23 Thread Amitava Shee
> I don't know the details, but the ticket is here: > > http://dev.clojure.org/jira/browse/CLJ-31?page=com.atlassian.jira.plu... > > Perhaps better if the REPL caught exceptions in the manner that Clojure's > REPL does: > > https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.c... >

Re: get the total memory used by a data structure?

2010-12-23 Thread Dale Thatcher
On Dec 23, 4:51 am, Robert McIntyre wrote: > I think it would be really cool to have a function that gives the > total number of bytes that a data structure consumes. > > so something like: > > (total-memory [1 2 [1 2]]) > > would return however many bytes this structure is. > > Is there already s

Public mutable fields in deftype

2010-12-23 Thread nicolas.o...@gmail.com
Dear all, Is there a way to make some mutable fields public in a deftype? Best regards, Nicolas -- 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: Funding 2011?

2010-12-23 Thread Rich Hickey
On Nov 28, 2010, at 9:07 PM, Jeremy Dunck wrote: In Dec 2009, Rich asked the community to step up and support core development -- and the community came through. I'm interested in clojure, but not using it professionally yet. I was wondering if funding for 2011 has already been worked out, or

Re: dispatching on a resulting range

2010-12-23 Thread Jay Fields
Ken said: "That seems sucky. What about adding a priority parameter to your defmethod-analogue? The predicates are kept sorted by priority." I disagree. To use your terms, I think your solution is equally "sucky". Sometimes adding config parameters makes sense and sometimes it adds noise. In th

Re: Calling methods with a dollar sign in them

2010-12-23 Thread Jay Fields
(Outer$Inner.) currently works as long as you (ns foo (:import [bar Outer$Inner])) I couldn't tell if you were asking, but I thought I'd mention it for those that have never noticed. Sent from my iPhone On Dec 22, 2010, at 5:41 PM, Sean Corfield wrote: > Since nested classes in Java get com

Re: get the total memory used by a data structure?

2010-12-23 Thread Mikhail Kryshen
If you want to know how your program uses memory, try using some Java profiling tool like VisualVM shipped with JDK. On Wed, 22 Dec 2010 23:51:48 -0500 Robert McIntyre wrote: > I think it would be really cool to have a function that gives the > total number of bytes that a data structure consume

Re: Is swank-clojure.el deprecated?

2010-12-23 Thread Steve Purcell
limux writes: > The clojure has released the 1.2 version, while swank-clojure.el is > used 1.1 yet, Is swank-clojure deprecated at all? Well, to be more precise; yes, swank-clojure.el is now unnecessary. You only need clojure-mode and slime. But see Phil's page for the details. -Steve -- You

Re: Is swank-clojure.el deprecated?

2010-12-23 Thread Steve Purcell
limux writes: > The clojure has released the 1.2 version, while swank-clojure.el is > used 1.1 yet, Is swank-clojure deprecated at all? Nope. Version 1.3 was just released. Take a look here for more info: https://github.com/technomancy/swank-clojure -Steve -- You received this message becau

Re: Let's see how fast we can make this

2010-12-23 Thread Remco van 't Veer
Simpler and faster: (count (clojure.string/replace s " " "")) On 2010/12/22 18:52, Rayne wrote: > I have a piece of code, and I'd like to see how fast it can be. > > (defn count-num-chars [^String s] > (loop [s s acc 0] > (if (seq s) > (recur (rest s) (if (= (first s) \space) acc

Re: get the total memory used by a data structure?

2010-12-23 Thread Remco van 't Veer
On 2010/12/23 05:51, Robert McIntyre wrote: > I think it would be really cool to have a function that gives the > total number of bytes that a data structure consumes. > > so something like: > > (total-memory [1 2 [1 2]]) > > would return however many bytes this structure is. > > Is there already