crm114: Controllable Regex Mutilator and Spam Filter
Do you already know crm114? Taking quotes of the crm114 book:
What is this? Some kind of grep bitten by a radioactive spider?
— apocryphalCRM114 isn’t ugly like PERL. It’s a whole different kind of ugly.
— John Bowker
Want to get a calculator using crm114? No problem:
% cat > calc << EOF { eval (:_dw:) /:@: :*:_dw: :/ output /:*:_dw: \\n/ } EOF % crm calc (42*23)+(11/3.14) # press return and EOF (ctrl-d) at this stage and get the result: 969.50318
There’s a crm114 book (PDF, 283 pages!) available for free download. Just apt-get crm114, the installed-size is less than 1MB. Thanks Maddi for pointing me to it again, it was on my todolist for ages. ;)
April 7th, 2007 at 20:53
You can also get it to run without ctrl-D, in a loop. Here, we see if the
input contained at least one character – if the input was empty, we exit.
Note also that if you invoke any CRM114 program with -q 1 (or start a math
expression with a capital R) all the math turns to RPN notation.
Long Live the HP-45 !! :-)
# crm114 program to be a desk calculator
# wsy@merl.com – free to use for any purpose.
window
output /Enter expressions. Hit return to evaluate, empty line to exit\n /
{
isolate (:y:)
input (:x:)
match [:x:] /./
eval (:y:) /:@::*:x::/
output /:*:y:\n /
liaf
}
– Bill Yerazunis