Jump to content

Execute a Markov algorithm: Difference between revisions

Removed mention of "stretch" goals; they're just input datasets that ensure correct implementation of the rules.
m (→‎{{header|Haskell}}: "putStrLn" -> "putStr")
(Removed mention of "stretch" goals; they're just input datasets that ensure correct implementation of the rules.)
Line 45:
 
'''Ruleset 3:'''<br>
A stretch goal. This tests for correct substitution order and may trap simple regexp based replacement routines if special regexp characters are not escaped.
<pre># BNF Syntax testing rules
A -> apple
Line 63:
 
'''Ruleset 4:'''<br>
A stretch goal. This tests for correct order of scanning of rules, and may trap replacement routines that scan in the wrong order. It implements a general unary multiplication engine. (Note that the input expression must be placed within underscores in this implementation.)
<pre>
### Unary Multiplication Engine, for testing Markov Algorithm implementations
Line 503:
I bought a bag of apples from my brother.
</lang>
'''Discussion''': The J implementation correctly processes all the rulesets, including the stretch goals. More details are available on the [[Talk:Markov Algorithm#explicit_vs_tacit|the talk page]].
 
=={{header|Perl}}==
Line 633:
assert replace(text1, extractreplacements(grammar2)) \
== 'I bought a bag of apples from T shop.'
# Stretch goals
assert replace(text2, extractreplacements(grammar3)) \
== 'I bought a bag of apples with my money from T shop.'
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.