The Raku Programming Language Collect, Conserve and Remaster Project
Originally published on 4 February 2010 by Carl Mäsak.
SF took my challenge to heart and started producing a “modern Raku” version of the example code in E02. His thought process can be seen here, and here.
After being a bystander for a few hours, I coulndn’t restrain myself anymore: I produced my own version. I should say at once that it’s quite different from SF’s: while he keeps close to the original E02 (which, in turn, sets out to prove that Raku is/was not very different from Perl), my version is a bit more liberal in its interpretation. I do mix in some of my personal preferences into it. Some examples:
$ARGS prompts("Search? ") anymore, but there’s a nice &prompt function which I used instead, together with a while loop.&show function now uses gather/take, rather than printing directly.&show code.&show makes a point of using a slurpy @_ rather than naming the parameters. I don’t. (Neither does SF.)given/when construct in the &insert function. To its credit, E02 tantalizingly hints of it, but then does a MIB mind-wipe. (You don’t recall that bit? Oh well…)undef to initiate the child nodes to some empty value. Both SF and I independently realized that just any undefined value won’t work if &insert is to have %tree in the signature, because %tree only binds to an Associative value. SF solved it by putting Hash (an undefined Hash type object) in the child nodes, and changed it to Hash.new in the later version. I used {}, which should be equivalent to Hash.new, but IMHO more idiomatic.I believe rewriting the exigeses in modern form is a very worthy activity. I hope we’ll see more of that. Raku suffers a bit from stale, outdated documentation, and having these in new versions would be valuable.
It’s also a very interesting historical activity to read the old apocalypses and exigeses, as I increasingly find. Raku has come a long, long way since 2001.