Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.PrintWriter
- import java.io.File
- val fileName = args(0)
- val p1 = new PrintWriter(new File(fileName + ".1"))
- val p2 = new PrintWriter(new File(fileName + ".2"))
- var count = 0
- for (l <- io.Source.fromFile(fileName).getLines) {
- if (l startsWith ">") count = count + 1
- count % 2 match {
- case 1 => p1 print (l + "\n")
- case 0 => p2 print (l + "\n")
- }
- }; p1.close; p2.close
- println("Done bro!")
- println("Seems to work fine, but concise imperative code is still imperative code :(")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement