Talk:Execute a Markov algorithm: Difference between revisions
Content added Content deleted
(→J: strikeout notes on original version, which has been replaced with fully functional (if ugly) version from talk page) |
m (→explicit vs tacit: tacit markovLexer & replace) |
||
Line 70: | Line 70: | ||
terminated =. _ * >@:{:@:] NB. (_ * terminated) = _ when terminated, 0 otherwise |
terminated =. _ * >@:{:@:] NB. (_ * terminated) = _ when terminated, 0 otherwise |
||
replaceArg =. 1&{ , #&.>@:(2&{) , 3&{ NB. index ; (#pattern) ; replacement |
replaceArg =. 1&{ , #&.>@:(2&{) , 3&{ NB. index ; (#pattern) ; replacement |
||
replace =. 2 ;@:A. >@:{:@:[ ; (0 , 1 {:: [) }.&.> (split~ >@:{.)~ |
|||
checkRule =. rule match txt |
checkRule =. rule match txt |
||
txt =. 1 {:: ] |
txt =. 1 {:: ] |
||
Line 75: | Line 76: | ||
match =. ] ; (>@:{.@:[ index ]) ; [ NB. txt ; index ; pattern ; replacement ; terminating |
match =. ] ; (>@:{.@:[ index ]) ; [ NB. txt ; index ; pattern ; replacement ; terminating |
||
index =. E. i. 1: |
index =. E. i. 1: |
||
ruleNo =. 0 {:: ] |
ruleNo =. 0 {:: ] |
||
markovLexer =. (,. ] (}.&.>~ ,. ]) ('.'={.)&.>)/@:|:@:lexed@:normal@:lines |
|||
lines =. LF cut h TAB&=`(,:&' ')} |
|||
normal =. a: -.~ (dltb h@:{.~ i:&'#')&.> |
|||
lexed =. 0 _1 {"1 '\s+->\s+' ( rxmatch h rxcut h ])S:0 ]</lang> |
|||
But I do not think that the tacit can claim any advantage over the explicit, in this case. Unless someone can come up with a clearer way of expressing the algorithm tacitly (maying using a different approach). |
But I do not think that the tacit can claim any advantage over the explicit, in this case. Unless someone can come up with a clearer way of expressing the algorithm tacitly (maying using a different approach). |