On Thu, Nov 26, 2009 at 12:31 AM, Jonathan Smith
<jonathansmith...@gmail.com> 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 filtering based on 'character
> at position x' in the string, as characters are entered... the
> resulting seqs could be memoized.

Isn't 'character at position x' an expensive test too? I have a
feeling tries will do better here - I actually started working on a
trie-based implementation, then decided to see if it really was the
linear regexp scan that was slowing things down, and when it looked
like it wasn't, I dropped the idea. I'll complete that and see how it
looks.

> Then, you could type a letter and quickly update the options based on
> the new character at that position (by simply filtering the stored
> sequence one more time). When you delete a letter, you run it and
> receive the memoized result from earlier.

Nice idea.

> 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-array will
> return an array of strings (It might help, I'm really not sure).

Another good idea. I forgot strings weren't Objects in java.

martin

-- 
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