Re: Enhanced primitive support - redux

2010-06-26 Thread B Smith-Mannschott
On Sat, Jun 26, 2010 at 05:58, Andrzej ndrwr...@googlemail.com wrote: On Sat, Jun 26, 2010 at 4:04 AM, Rich Hickey richhic...@gmail.com wrote: equiv, the revenge of num Has it already been decided that some sort of this new numeric tower will find its way into Clojure? Personally, I think

Re: Clojure / Common Lisp Question

2010-06-26 Thread Michael Gardner
On Jun 26, 2010, at 12:37 AM, rob levy wrote: Rich Hickey's insightful videos have caused me to stop writing loops whenever possible. For me this is the same level of thinking-change that happened when I moved to using Structured Programming rather than GOTO (in Fortran). Rich needs to write

Re: Enhanced primitive support - redux

2010-06-26 Thread Stefan Kamphausen
Hi, On 25 Jun., 21:04, Rich Hickey richhic...@gmail.com wrote: equiv, the revenge of num [...] Feedback welcome, sorry, no feedback, but one question which is rather important to me: will this make it into Clojure 1.2? Kind regards, Stefan -- You received this message because you are

Re: Enhanced primitive support - redux

2010-06-26 Thread Nicolas Oury
I think I pointed it out, and I reiterate it will probably not improve performance a lot (Except if you use always the 5 same numbers). On Sat, Jun 26, 2010 at 7:59 AM, B Smith-Mannschott bsmith.o...@gmail.comwrote: This was suggested on the previous thread on this topic as well, but I don't

ClojureX

2010-06-26 Thread Michael Kohl
Please not that ClojureX is now discontinued. There are enough viable alternatives like David's clj [1] by now, so I don't see the need for this project anymore. If you do however, feel free to fork away :-) Michael [1] http://github.com/liebke/clj -- You received this message because you are

Re: State of Clojure web development

2010-06-26 Thread James Reeves
On 26 June 2010 03:36, MarkSwanson mark.swanson...@gmail.com wrote: I still like timestamps even with per-user logging. Sorry, I guess wasn't entirely clear. The maps would still contain timestamps. My point is that we should get away from the idea thinking of logs as unstructured text strings.

Drawable Sets

2010-06-26 Thread Nicolas Oury
Dear all, for a project, I need a data structure to represent finite distribution, that is a set of elements, each of which having a mass in the set, and two functions: - total-mass : the sum of the masses of each element - draw : return an element with a probability proportional to its mass I

Re: Enhanced primitive support - redux

2010-06-26 Thread Mike Meyer
[Format recovered from top posting.] Nicolas Oury nicolas.o...@gmail.com wrote: On Sat, Jun 26, 2010 at 7:59 AM, B Smith-Mannschott bsmith.o...@gmail.comwrote: This was suggested on the previous thread on this topic as well, but I don't think it was pointed out that *Java already does this*.

Re: Enhanced primitive support - redux

2010-06-26 Thread Andrzej
On Sat, Jun 26, 2010 at 3:59 PM, B Smith-Mannschott bsmith.o...@gmail.com wrote: This was suggested on the previous thread on this topic as well, but I don't think it was pointed out that *Java already does this*. See the inner class IntegerCache at line 608:

Re: Enhanced primitive support - redux

2010-06-26 Thread Nicolas Oury
http://tech.puredanger.com/2007/02/01/valueof/ http://tech.puredanger.com/2007/02/01/valueof/Apparently, a program that only access 1 integer (0) is only twice as fast when caching. We are very far from the *10/20 that occurs. On Sat, Jun 26, 2010 at 2:04 PM, Mike Meyer

Re: Enhanced primitive support - redux

2010-06-26 Thread Nicolas Oury
And, by the way, after having looked into the compiler source, the current Master already uses the valeOf function. On Sat, Jun 26, 2010 at 2:31 PM, Nicolas Oury nicolas.o...@gmail.comwrote: http://tech.puredanger.com/2007/02/01/valueof/

Re: Drawable Sets

2010-06-26 Thread Jules
You can store the numbers in a vector [2 5 3]. Instead of doing this store the cumulative weight v = [0 2 7 10]. What your problem comes down to is given a number n, find the the lowest index i such that v[i] = n. This can be accomplished with binary search. You can also use a binary search tree

Re: Drawable Sets

2010-06-26 Thread Nicolas Oury
Thank you very much for your answer. I forgot to tell you that I also needs to be able to have usual set operations. They become linear with your 1st idea. (But, sorry, it's my bad! I should have asked the right question. Your answer is very good for the question I actually asked, not the one I

Re: Clojure / Common Lisp Question

2010-06-26 Thread rob levy
You can use Perl's map/grep pretty much anywhere, though they're not as nice to use because the language is a mess (albeit more functional than Python). I, too, have found myself using fewer and fewer explicit loops as time goes on, starting with a revelation about the versatility of map while

Re: Enhanced primitive support - redux

2010-06-26 Thread David Powell
Hi, Re: caching boxed ints: I think I pointed it out, and I reiterate it will probably not improve performance a lot (Except if you use always the 5 same numbers). Reiteration won't make it true. At about 10m - 12m into this video, Cliff Click suggests that Java's caching of Integer objects

Re: Drawable Sets

2010-06-26 Thread Garth Sheldon-Coulson
Are there going to be a lot of deletions from the set? Or mostly insertions? If it's mostly insertions (or if it's just a static data structure that stays the same once built) then I think I can help. On Sat, Jun 26, 2010 at 9:01 AM, Nicolas Oury nicolas.o...@gmail.comwrote: Dear all, for a

Re: Drawable Sets

2010-06-26 Thread Nicolas Oury
Insertion and deletions. But I would like to hear your idea anyway. Always good to hear ideas :) On Sat, Jun 26, 2010 at 7:58 PM, Garth Sheldon-Coulson g...@mit.edu wrote: Are there going to be a lot of deletions from the set? Or mostly insertions? If it's mostly insertions (or if it's just

Re: Drawable Sets

2010-06-26 Thread Garth Sheldon-Coulson
Well, my idea involves rejection sampling. In order to sample an element from the set in a mass-weighted fashion, you can sample an element in a uniform fashion and then reject the sample with a certain probability (more below). If you do reject the sample, you keep drawing from the uniform

Re: Drawable Sets

2010-06-26 Thread Garth Sheldon-Coulson
Sorry - the call at the end of my message should be: (some identity (apply pcalls (repeat f))). I also realized that the random seed contention issues that were discussed on the list earlier might prevent very much gain from parallelizing the accept-reject. Garth On Sat, Jun 26, 2010 at 5:04

Re: Drawable Sets

2010-06-26 Thread Jules
By storing the set in a binary (or n-ary) tree and maintaining the total weight in a node you can make every operation (draw, insert, union, intersect) O(log n) and total-weight O(1). Draw like this (where node(w,l,r) denotes a node with weight w, left subtree l and right subtree r and leaf(w,v)

Protocols

2010-06-26 Thread Mark Engelberg
Is there a list somewhere of all the protocols built-in to Clojure 1.2's core that are available for extension? -- 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