C# has had "Pipelining" (aka Linq) for 17 years. I do miss this kind of stuff in Go a little.
I don't see how LINQ provides an especially illuminating example of what is effectively method chaining. It is an exemplar of expressions [0] more than anything else, which have little to do with the idea of passing results from one method to another. [0]: https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...
fn get_ids(data: Vec) -> Vec { 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) }
Same thing in 15 year old C# code.
List GetIds(List data)
{
return data
.Where(w => w.IsAlive())
.Select(w => w.Id)
.ToList();
}