Find Related products on Amazon

Shop on Amazon

Pipelining might be my favorite programming language feature

Published on: 2025-08-23 01:16:16

Epistemic status: Don’t take it too seriously. Or do. idk, I can’t stop you. Pipelining might be my favorite programming language feature. What is pipelining? Pipelining is the feature that allows you to omit a single argument from your parameter list, by instead passing the previous value. When I say pipelining, I’m talking about the ability to write code like this: fn get_ids (data: Vec < Widget > ) -> Vec < Id > { data.iter() // get iterator over elements of the list .filter( | w | w.alive) // use lambda to ignore tombstoned widgets .map( | w | w.id) // extract ids from widgets .collect() // assemble iterator into data structure (Vec) } As opposed to code like this. (This is not real Rust code. Quick challenge for the curious Rustacean, can you explain why we cannot rewrite the above code like this, even if we import all of the symbols?) fn get_ids (data: Vec < Widget > ) -> Vec < Id > { collect(map(filter(iter(data), | w | w.alive), | w | w.id)) } I honestly feel like this s ... Read full article.