Re: Creating a map algorithmically

2011-08-11 Thread Kevin Sookocheff
Thanks Justin, this is a terrific implementation. -- 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. T

Re: Creating a map algorithmically

2011-08-10 Thread Justin Kramer
See also David Nolan's post: http://dosync.posterous.com/lispers-know-the-value-of-everything-and-the Justin On Tuesday, August 9, 2011 6:02:00 PM UTC-4, pmbauer wrote: > > For the sieve, if performance matters, clojure's native data structures may > not be the best choice. > A mutable array of

Re: Creating a map algorithmically

2011-08-10 Thread Kevin Sookocheff
Thanks Sumil. Does anyone know what algorithm they are implementing? It looks like a wheel factorization but I can't tell from lack ofcomments. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups

Re: Creating a map algorithmically

2011-08-09 Thread Sunil S Nandihalli
you should considering looking at clojure.contrib.lazy-seqs/primes to get an idea it is implemented there.. Sunil. On Wed, Aug 10, 2011 at 1:48 AM, Chouser wrote: > On Tue, Aug 9, 2011 at 12:50 PM, Kevin Sookocheff > wrote: > > Hi, > > > > I have a question regarding the map data structure. I'm

Re: Creating a map algorithmically

2011-08-09 Thread pmbauer
For the sieve, if performance matters, clojure's native data structures may not be the best choice. A mutable array of boolean primitives could be more apropos. (defn prime-sieve [^long n] (let [^booleans sieve (make-array Boolean/TYPE (inc n))] ...) ... using aset/aget to write/read sieve

Re: Creating a map algorithmically

2011-08-09 Thread Chouser
On Tue, Aug 9, 2011 at 12:50 PM, Kevin Sookocheff wrote: > Hi, > > I have a question regarding the map data structure. I'm trying to program a > Sieve of Eratosthenes using the algorithm at Wikipedia: > > Input: an integer n > 1 > > Let A be an array of bool values, indexed by integers 2 to n, > i

Re: Creating a map algorithmically

2011-08-09 Thread joegallo
(zipmap (range 2 (inc n)) (repeat true)) -- 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 unsubsc

Re: Creating a map algorithmically

2011-08-09 Thread Bob Shock
user=> (def n 5) #'user/n user=> (zipmap (range 2 (inc n)) (repeat true)) {5 true, 4 true, 3 true, 2 true} user=> As a start... On Aug 9, 10:50 am, Kevin Sookocheff wrote: > Hi, > > I have a question regarding the map data structure. I'm trying to program a > Sieve of Eratosthenes using the algo

Creating a map algorithmically

2011-08-09 Thread Kevin Sookocheff
Hi, I have a question regarding the map data structure. I'm trying to program a Sieve of Eratosthenes using the algorithm at Wikipedia: *Input*: an integer *n* > 1 Let *A* be an array of bool values, indexed by integers 2 to *n*, initially all set to *true*. *for* *i* = 2, 3, 4, ..., *while*