summaryrefslogtreecommitdiffstats
path: root/RNA.rs
diff options
context:
space:
mode:
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));
}
}