[~/Desktop] dave$ cat foobar.rb ; foobar.rb
#!/usr/local/bin/ruby
get a Stanislaw Lem quote containing underscores and backspaces, then
replace the word following the deleted underscores and backspaces
with the same word surrounded by emphatic arrow glyphs
fortune -m Nillity
.each do |x|
x.sub!( /(_+\010+)([a-zA-Z]+)/, “–>#{$2}<–” )
print x
end
This produces:
(science)
%
Everyone knows that dragons don’t exist. But while this simplistic
formulation may satisfy the layman, it does not suffice for the
scientific
mind. The School of Higher Neantical Nillity is in fact wholly
unconcerned
with what --><-- exist. Indeed, the banality of existence has been
so amply demonstrated, there is no need for us to discuss it any further
here. The brilliant Cerebron, attacking the problem analytically,
discovered three distinct kinds of dragon: the mythical, the chimerical,
and the purely hypothetical. They were all, one might say, nonexistent,
but each nonexisted in an entirely different way …
– Stanislaw Lem, “Cyberiad”
%
The word “does” should appear between the --><-- glyphs:
–>does<–
but it doesn’t. What am I overlooking? I’ll admit to being a Perl
convert, so maybe I’m trying to do something non-Ruby?
TIA,
dave
···
–
[“10110100101101000101000000100010100001100110111010010110001001100000010011000010011101000000010011110010110011100001011010100110001101101001000010010000001001101100011011110110110011100001011010100110001101100000001010110110100001101100011001110100110001101111011010110110010100001100001010100110001001101000011001001110000001000100101010000110000011101001011000100110110011100011010000000100100100101000001010010000000101100010111000101110000011100101110011110100111101000001011011110110101101101010011000001110100001101110011010100110011101001011011010000110110001100111010011000110111101101011011011110100001001101100011011110110110011100001011010100110001101101111010001010000010001001001101010100110001011100000010010000010011101101111011000101110000101101010011001001110000001000100101010101110010001101001111000000100000100101000011011000110110101101010011001001110”].pack(“b*”)