On 6 Aug 99, at 12:51, Chaim Frenkel wrote: > Would using a bit vector be suitable? > > $value = 0; > $value ||= 1<<(ord($_)-ord('a')) for (split //, "radar") ; > > or > > $value = ""; > vec($value, ord($_)-ord('a'), 1)=1 for (split //, "radar") ; > > Depending if you want to keep it numeric or string. Problem is that it won't catch duplicate letters. RADAR and ROTOR gets two jots, but I'm not sure how you'd keep track of the second 'R' using a bit vector. /Bernie\ > >>>>> "BC" == Bernie Cosell <bernie@fantasyfarm.com> writes: > > BC> Small challenge [only asking here because I'm finding it surprisingly > BC> difficult to do, and so I'm thinking that I must be overlooking something > BC> clever]: Write a boolean subroutine to determine whether a word matches > BC> a probe/jots result; _fast_ is more important than small. > > BC> I figure you can assume that either/both of the words have some kind of > BC> associated info along with them [that is, neither word need be just a > BC> string --- e.g., the 'words' could be sorted lists of letters if that > BC> makes the match faster] -- Bernie Cosell Roanoke Electronic Village mailto:bernie@rev.net Roanoke, VA ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe