summaryrefslogtreecommitdiffstats
path: root/REVC.rs
diff options
context:
space:
mode:
Diffstat (limited to 'REVC.rs')
-rw-r--r--REVC.rs29
1 files changed, 6 insertions, 23 deletions
diff --git a/REVC.rs b/REVC.rs
index 3c9e9e7..2503c87 100644
--- a/REVC.rs
+++ b/REVC.rs
@@ -1,26 +1,9 @@
-use io::{stdin,println,ReaderUtil};
-
-/* really feels like there should be a more efficient way to do this */
-fn reverse(s: &str) -> ~str {
- let mut r = ~"";
- str::reserve(&mut r, str::len(s));
- for str::each_char(s) |ch| {
- str::unshift_char(&mut r, ch)
- }
- r
-}
-
-fn complement(ch: char) -> char {
- match ch {
- 'A' => 'T',
- 'C' => 'G',
- 'G' => 'C',
- 'T' => 'A',
- _ => fail ~"Unknown character found",
- }
-}
+extern mod rosalind;
+use rosalind::dna::complement;
+use rosalind::io::input_line;
+use rosalind::str::reverse;
fn main() {
- let dna = stdin().read_line();
- println(str::map(reverse(dna), complement));
+ let dna = input_line();
+ io::println(str::map(reverse(dna), complement));
}