summaryrefslogtreecommitdiffstats
path: root/RNA.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-03-08 20:14:51 -0600
committerJesse Luehrs <doy@tozt.net>2013-03-08 20:14:51 -0600
commitae98925062d5a392a73df4a1456df3a4a3be9b18 (patch)
tree3b89c49d97b9c38551578bf57619a9649dd0b4fb /RNA.rs
parentb331d192d8da5b7397240d7eced71cbf0ab8cc55 (diff)
downloadrosalind-ae98925062d5a392a73df4a1456df3a4a3be9b18.tar.gz
rosalind-ae98925062d5a392a73df4a1456df3a4a3be9b18.zip
factor common behavior out into a library
Diffstat (limited to 'RNA.rs')
-rw-r--r--RNA.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/RNA.rs b/RNA.rs
index 30091fe..9c20887 100644
--- a/RNA.rs
+++ b/RNA.rs
@@ -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));
}
}