Arrays being truthy in JS still catches me out sometimes.
In Python or Lisp, empty lists are falsey and truthiness is safe and idiomatic.
miniblog.
Related Posts
Do commas ever appear in idiomatic Clojure? It's syntactically legal but I don't think I've ever seen them in the wild.
Lisp is the only language I've seen where it's idiomatic to have some locals scoped to the *middle* of a function. It's a consequence of let blocks.
It's neat, but I rarely miss it elsewhere. I'm happy with "scoped from here to the end of the block" in e.g. C or Rust.
I find myself writing .iter().map(|x| ...).collect() really often in Rust. I'm wondering if I should write a helper method on Vec, but it seems less idiomatic.
Iterators compose, but they're less versatile (no indexing) and awkward to return from functions.