A really fun function name in Common Lisp: the. It returns the value passed in, as well as checking the type. https://www.lispworks.com/documentation/HyperSpec/Body/s_the.htm#the
It reads rather nicely: (the integer foo).
miniblog.
Related Posts
Copilot was super helpful for changing some locals to lazy_static!:
let integer_re = Regex::new(...) // old
static ref INTEGER_RE = Regex::new(...) // new
Unfortunately, it added a $ to the end of my first regex! It saved me a ton of keystrokes, but needed careful checking.
I don't have a favourite 'just an integer' type in Rust. I was writing a progress function for a Rust program that counts up to 20 input files.
u64 is sometimes fiddly, usize makes me think about indexing, and u32/u16/u8 make me think that something is performance sensitive.
OCaml has several unusual design features that I've come to appreciate.
(1) Separating integer and float addition is really clear.
(2) No subtyping (everything is 'a or concrete) simplifies lots too.