diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-03-08 20:14:51 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-03-08 20:14:51 -0600 |
commit | ae98925062d5a392a73df4a1456df3a4a3be9b18 (patch) | |
tree | 3b89c49d97b9c38551578bf57619a9649dd0b4fb /RNA.rs | |
parent | b331d192d8da5b7397240d7eced71cbf0ab8cc55 (diff) | |
download | rosalind-ae98925062d5a392a73df4a1456df3a4a3be9b18.tar.gz rosalind-ae98925062d5a392a73df4a1456df3a4a3be9b18.zip |
factor common behavior out into a library
Diffstat (limited to 'RNA.rs')
-rw-r--r-- | RNA.rs | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1,12 +1,16 @@ use io::{stdin,stdout,ReaderUtil,WriterUtil}; +extern mod rosalind; +use rosalind::dna::transcribe; + fn main() { let stdout = stdout(); for stdin().each_char() |ch| { - match ch { - 'T' => { stdout.write_char('U') } - '\n' => { stdout.write_char(ch); return } - _ => { stdout.write_char(ch) } + // each_char returning -1 here is a bug + if (ch == '\n' || ch == (-1 as char)) { + stdout.write_char('\n'); + return; } + stdout.write_char(transcribe(ch)); } } |