Larry Bezeau wrote: > On Thu, 27 Oct 2005, Steve Wampler wrote: > > >>And finally, here's another approach. Note that the semantics are >>slightly different, in that this version starts by removing duplicated >>letters from the input: >> >> procedure permute(s, i) >> if i < 1 then fail >> s := cset(s) >> suspend if i = 1 then !s >> else (c := !s) || permute(s--c, i-1) >> end >> >>-- >>Steve Wampler -- [EMAIL PROTECTED] >>The gods that smiled on your birth are now laughing out loud. > > > I wonder if someone could provide a main procedure for > the above procedure. The following line > > every write(&output, !permute("abcde",4)) > > besides calling permute appropriately breaks up the returned > string into individual characters. I think that this is what > the Griswold book says it is supposed to do but how could one > alter that statement to get each permutation on one line?
Drop the "!". It's not needed to generate the permutations as permute() is a generator. All it is doing is breaking each generated permutation into single characters. Here's a main: procedure main(args) s := args[1] | "abc" m := integer(args[2]) | 2 every write(permute(s,m)) end -- Steve Wampler -- [EMAIL PROTECTED] The gods that smiled on your birth are now laughing out loud. ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ Unicon-group mailing list Unicon-group@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/unicon-group