ba1h.c3 (570B) - raw
1 // approximate pattern match 2 3 module ba1h; 4 import std::io; 5 import std::io::file; 6 import std::collections; 7 8 import util; 9 10 fn int main(String[] args) { 11 if (args.len != 2) { 12 io::eprintn("Please supply path to data file"); 13 return 1; 14 } 15 File f = file::open(args[1], "rb")!!; 16 String pattern = io::treadline(&f)!!; 17 String genome = io::treadline(&f)!!; 18 String d_str = io::treadline(&f)!!; 19 int d = d_str.to_integer(int)!!; 20 int[] matches = util::approximate_pattern_matching(pattern, genome, d); 21 foreach (match : matches) { 22 io::printf("%d ", match); 23 } 24 return 0; 25 }