On Nov 25, 2:09 pm, Martin DeMello wrote:
> On Thu, Nov 26, 2009 at 12:31 AM, Jonathan Smith
>
> wrote:
>
> > I think a better way to do this is to not use a regex at all.
> > Canonically I think this sort of thing is (would be?) implemented by
> > constructing a 'sequence' of strings, (first f
On Nov 25, 11:09 am, Martin DeMello wrote:
> On Thu, Nov 26, 2009 at 12:31 AM, Jonathan Smith
> > To display you would want to use 'into-array' and your 'setListData'
> > function, because you seem to have a homogeneous collection of
> > strings; while to-array makes you an array of objects, into-
On Thu, Nov 26, 2009 at 12:31 AM, Jonathan Smith
wrote:
>
> I think a better way to do this is to not use a regex at all.
> Canonically I think this sort of thing is (would be?) implemented by
> constructing a 'sequence' of strings, (first filtered based on
> potential word length) and recursively
--
> is still slow, but dropping down to
>
> (def wlistdata (to-array (take 26 (words-with "..."
>
> (def update-wlist #(let [w (take 26 (words-with (current-word)))]
>(. words setListData wlistdata)))
>
> leaves everything running smoothly. Is there a more e
ooh, i wondered how words-with was so fast - my first thought was that
it was bound to be the bottleneck, but when i removed the to-array and
things sped up i figured maybe the jvm was more efficient than i
thought :) laziness takes a bit of getting used to!
m.
On Thu, Nov 26, 2009 at 12:26 AM, a
Bear in mind that when going from the "slow" to the "fast", you not
only removed the repeated calls to to-array, but also removed the
overhead of words-with, since the lazy seq returned from the let
doesn't get fully realized.
Try changing your "fast" version to:
(def update-wlist #(let [w (doall
I'm writing a crossword editor that provides a list of suggestions to
fill in the current word. This is displayed in a listbox to the right
of the grid, and every time the cursor is moved, I update it via
(def update-wlist #(let [w (take 26 (words-with (current-word)))]
(. wor