Le Lundi 8 Avril 2002 22:23, Yanick a écrit :

[snip]

>       So, to summarize, there is no dictionary magic, just
> unwholesome programming dirty tricks. :)
>
> Joy,
> `/anick

I don't agree, I reduce the problem:

<input>
hack
snooped
tables
salt
spiff
feeling
spooned
last
grep
bleats
gas
ablest
fleeing
stable
slat
drive
</input>

<program 1>
#!/usr/bin/perl -ln
$h{X,sort/./g}.="$_ "}{print for %h
</program 1>

<output 1>
Xdenoops
snooped spooned
Xegpr
grep
Xalst
salt last slat
Xachk
hack
Xags
gas
Xabelst
tables bleats ablest stable
Xeefgiln
feeling fleeing
Xdeirv
drive
Xffips
spiff
</output 1>

<program 2>
#!/usr/bin/perl -l
while (<>) {
        chomp;
        $h{X,sort/./g}.="$_ "
}
foreach $k (%h) {
        print "key=$k value=$h{$k}"
}
</program 2>

<output 2>
key=Xdenoops value=snooped spooned
key=snooped spooned  value=
key=Xegpr value=grep
key=grep  value=
key=Xalst value=salt last slat
key=salt last slat  value=
key=Xachk value=hack
key=hack  value=
key=Xags value=gas
key=gas  value=
key=Xabelst value=tables bleats ablest stable
key=tables bleats ablest stable  value=
key=Xeefgiln value=feeling fleeing
key=feeling fleeing  value=
key=Xdeirv value=drive
key=drive  value=
key=Xffips value=spiff
key=spiff  value=
</output 2>

Sure, I cannot explain why, in program 2, "snooped spooned", for instance, 
acts as a value in a line and as a key in the next. Perhaps am I wrong, but 
the minimal program "1" selects "spooned" and "snooped" and not "pooneds" or 
other. Maybe there is no dictionary. Then, why all anagrams are valid english 
words? Why I cannot found valids anagrams if I use another langage?

I'll see you later : it is time for me to sleep before work :)
-- 
Jean-Pierre Vidal
[EMAIL PROTECTED]

Reply via email to