Elixir Streams
blog.drewolson.org
blog.drewolson.org
I think it's the best language out there-- the power of erlang and OTP and the fun of, well, elixir. It's more fun than Ruby and Python.
There's a lot of neat stuff in Elixir, and the community is great too. I honestly it may be the first functional language that becomes widely used. Hopefully.
BufReader::new(File::open("myfile.txt").unwrap())
.lines()
.enumerate()
.map(|(i, line)| format!("{}: {}", i, line.unwrap()))
.take(1)
.next().unwrap()
(formatted for non-monospace font readability). Note the .unwrap() is where error handling should normally happen.
In Python 3, for example, map() returns a generator. So you can no longer transform a list into another list with `new = map(func, lst)`. You have to do `new = list(map(func, lst))`. One of the most subtle gotchas when upgrading from 2 to 3 is having to wrap list() around functions and methods like map(), range(), dict.items(), etc.
Discussion I've seen about Rust on less moderated websites often seems to make fun of the .unwrap() spam seen in a lot of programs, to the point of the mockery even dominating some discussions.
Streams and lazy evaluation are really nice, but sometimes you just want some nice procedural handling.
lmap = lambda f, l: list(map(f, l))
somewhere in your project, then use new = lmap(func, lst)Then again, map() and friends are not exactly the recommended way, list comprehensions and generator expressions are usually preferred by the BDFL.