Talk:Execute a Markov algorithm: Difference between revisions

m
(→‎J: WP says the Markov Algorithm has stricter evaluation order we considered -- other languages might want to check their implementations too)
Line 17:
=== explicit vs tacit ===
 
Returning to this just now, I realized from the WP description (and its the [[wp:Talk:Markov algorithm#Examples|WPTalk page]]) that the Markov Algorithm has a very strict order of evaluation -- much stricter than I originally considered. In particular, the entire ruleset must be applied after every successful match. That means, for example, if rule 0 matches, then make one and only substitution (to the leftmost match) and reapply rule 0 until it no longer matches. Then apply rule 1. If that matches, then start all over and apply rule 0. And so on. At any point, if a terminating rule matches, make the single substitution and quit.
 
That means, for example, if rule 0 matches, then make one and only substitution (to the leftmost match) and reapply rule 0 until it no longer matches. Then apply rule 1. If that matches, then start all over and apply rule 0. And so on. At any point, if a terminating rule matches, make the single substitution and quit.
 
I haven't read the other implementations yet, but at least for the J it means we must take a different approach. In particular, we cannot use <code>stringreplace</code> because it replaces all matches (for even a single rule) simultaneously. We must take a much more iterative approach.
Anonymous user