Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on A Little Story About the `yes` Unix Command. Parent comment
This is how I'd write it instead:
fn main() { match env::args_os().nth(1) { None => write(b"y\n"), Some(arg) => { let mut arg = to_bytes(arg); arg.push(b'\n'); write(&arg); } } process::exit(1); }
This is how I'd write it instead:
It's just as efficient and far more readable. It avoids Cow, a lambda, and the chain of combinators.