[Tutor] help on scope

Glen Wheeler wheelege@tsn.cc
Wed, 25 Jul 2001 15:58:40 +1000


> >  What what what, recursion for anagrams?  I have been a little lax on
the
> >tutor list (go the integer division debate...well, it did go) but I'm
pretty
> >sure you don't need to do recursion for something like an anagram
program.
> >  Unless of course you are trying to learn recursion - at which point
I'll
> >be quiet :)
> I don't know how to write an anagram program. It's something I've wanted
to
> do for years but because I don't think like a programmer I never made it.
At
> the moment I have to functions: one which rotates the letters in a word
and
> another one that splits the word up. I get one to call the other. It's
some
> kind of recursion and it nearly but not quite works.
>

  Well, don't I look silly.  I was thinking of something other than
anagrams...but hmm if you really want to make an anagram program then you
will have to check the resulting words against a very large
dictionary...then somehow check out sentence structure, that's if your going
to throw in a whole bunch of spaces.  Man, there would be millions of
combinations in any number over like 15...
  Yes, you will need recursion to get all permutations of the letters in a
sentence.  I think the real difficulty will be the whole filtering thing - I
won't give you the recursive function to get all the permutations, more than
likely you can write one yourself after ready Danny's recent post on
recursion.

  HTH,
  Glen.