src/main.oxl
use self.count { countWords, top }
use std.io { File }
use std.os { args }
const TOP_N = 10
@error data Usage { msg: str }
fn main() -> () | Usage | IoError io {
let path = args().get(1) ?? fail Usage{ msg: "usage: wordcount <file>" }
let text = File.readText(path)?
for line in top(countWords(text), TOP_N) { print(line) }
}Source: examples/wordcount/src/main.oxl