What's more, each rule is applied at most once as the following example http://en.wikipedia.org/wiki/Markov_algorithm#Execution_2 shows.
R.E. Boss -----Oorspronkelijk bericht----- Van: [email protected] [mailto:[email protected]] Namens Dan Bron Verzonden: vrijdag 18 december 2009 3:08 Aan: 'Programming forum' Onderwerp: Re: [Jprogramming] Tacit exercise R.E. wrote: > If the rules are > AbA -> A > AbA -> B > what becomes "AbAbA" then? "A" or "B"? Because evaluation starts all over after every successful match, the answer is "A". Tracing the evaluation: Start Input : AbAbA Apply rule 0 : AbA -> A Match leftmost pattern: AbAbA --- Substitute : AbA Start over Input : AbA Apply rule 0 : AbA -> A Match leftmost pattern: AbA --- Substitute : A Start over Apply rule 0 : AbA -> A No match : A Apply rule 1 : AbA -> B No match : A No more rules End -Dan ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
