User talk:Wamba: Difference between revisions

Content added Content deleted
(Yep!)
Line 5: Line 5:


::many thanks Wamba. That's brill. Usually I manage to get the explanation into the incorrect message banner, but when you go to greater lengths and have code like you have, then it's best to put it in the talk page. Thanks again! --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 23:23, 24 June 2015 (UTC)
::many thanks Wamba. That's brill. Usually I manage to get the explanation into the incorrect message banner, but when you go to greater lengths and have code like you have, then it's best to put it in the talk page. Thanks again! --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 23:23, 24 June 2015 (UTC)

== Markov chain text generator ==

Really good to get 'rotor' back into the Perl 6 solution, a definite improvement over the fix I made.
But I think two details need to be taken care of:<br>
• @prefix should contain strings, not lists (eg "Alice was" not ("Alice", "was")<br>
• the routine needs to explicitly return a hash

So something along the lines of:
<pre>my @prefix.push: .join(' ') for @words.rotor: $n => -$n+1;
(%).push: @prefix Z=> @words[$n .. *];
</pre>