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