Hi, Ken, Thanks for the suggestion.
As I was looking at a suffix tree, it suddenly struck me that the following strategy may do just as well: 1. Use rest and next to generate the tentative suffix sets, thus for "directional", it will give the set of #{irectional rectional ectional ctional tional ional onal nal al l}. 2. Intersection this with the set of suffixes. 3. Select the longest item in the result set. I'm trying this one out now. Tuba On Mon, Aug 8, 2011 at 11:23 AM, Ken Wesson <kwess...@gmail.com> wrote: > On Mon, Aug 8, 2011 at 11:41 AM, Tuba Lambanog <tuba.lamba...@gmail.com> > wrote: > > Hi, > > Thank you for the tip. It does look like the Patricia tree -- or suffix > tree > > -- is made-to-order for this kind of task. I'm reading up on it. > > You're welcome. > > > Would there be a Clojure implementation of this technology, I wonder. > > Even if not, it's probably trivial to slap one together, and test it, > in less than a day in Clojure. > > As for generating your candidate seqs of prefixes and suffixes, just > cons onto an initial nil in your reduction* and you'll end up with a > seq that, traversed forwards, goes from longest candidate to shortest. > For suffixes you'll want to (map #(apply str (reverse %)) the-seq), > though, to get the suffixes the right way around (since they'll need > to be stored reversed in their tree). > > -- > Protege: What is this seething mass of parentheses?! > Master: Your father's Lisp REPL. This is the language of a true > hacker. Not as clumsy or random as C++; a language for a more > civilized age. > > -- > 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 > -- 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