reverse-complement Matz's Ruby #5 program
source code
# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org
#
# Contributed by Aaron Tavistock
LEADER = ">".freeze
CR = "\n".freeze
STDIN.each_line(LEADER).lazy.each do |chunk|
header, segment = chunk.split(CR, 2)
next unless segment
segment.delete!(CR+LEADER)
segment.reverse!.tr!('wsatugcyrkmbdhvnATUGCYRKMBDHVN','WSTAACGRYMKVHDBNTAACGRYMKVHDBN')
STDOUT.write LEADER, header, CR
segment_size = segment.size
idx=0
while idx < segment_size do
STDOUT.write segment.byteslice(idx,60), CR
idx += 60
end
end
notes, command-line, and program output
NOTES:
64-bit Ubuntu quad core
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
So old that I haven't been able to get rubygems to work
no backport, no gmp
Sun, 02 Jun 2019 06:27:03 GMT
COMMAND LINE:
/usr/bin/ruby revcomp.mri-5.mri 0 < revcomp-input250000.txt
PROGRAM FAILED
PROGRAM OUTPUT:
revcomp.mri-5.mri:9: undefined method `lazy' for #<Enumerable::Enumerator:0x7f758322f7b8> (NoMethodError)