update! is of my own making, based on assoc! and update-in

On Nov 5, 7:30 pm, B Smith-Mannschott <bsmith.o...@gmail.com> wrote:
> On Fri, Nov 5, 2010 at 17:38, pepijn (aka fliebel)
>
>
>
>
>
>
>
>
>
> <pepijnde...@gmail.com> wrote:
> > I will have a look around.
>
> > I listed the map I used in my first email, It's on my Dropbox:
> >http://dl.dropbox.com/u/10094764/World2.zip
>
> > Meanwhile I wrote a function that is already twice as fast as I had,
> > no memory problems, no threads. One tinny problem: it doesn't produce
> > the same result.
>
> > It's the one at the top:https://gist.github.com/663096
>
> > The other day I found out that this kind of logic will actually refer
> > to the same same transient. This eliminates the remainder and associng
> > in the areduce fn second in the list, but I'm not sure this is
> > reliable, and it might be the reason why some results get lost.
>
> (defn freqs [^bytes blocks]
>   (loop [idx 0
>          ret (cycle (repeatedly 128 #(transient {})))]
>     (if (< idx (alength blocks))
>       (do
>         (update! (first ret) (aget blocks idx) (fnil inc 0))
>         (recur (inc idx) (next ret)))
>       (map persistent! (take 128 ret)))))
>
> I'm not familiar with incanter, which defines update!, but the update!
> call makes me suspicious. Transients are not designed to be banged on
> in place. That would explain your losing results.
>
> // ben

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to