magicalhippo 3 days ago

If I give you a function "f(x) := 3 * x", is it really that useful to talk about it as a container of the natural numbers?

The reverse though is useful, a container looks like a function that takes one or more indices and returns a value or element.

1
rebeccaskinner 3 days ago

I think that understanding the (moral) equivalence is useful in both directions. In particular, I think helping people understand the "function-as-container" analogy is a useful way for people to understand pure functions- another thing that's conceptually simple but a lot of people struggle to really wrap their mind around it.

magicalhippo 2 days ago

Personally I would say it muddies the water for me, as "container" has strong connotations in other directions.

But then I've never thought the concept of a pure function to be particularly difficult, despite growing up on procedural languages.

It's other bits that I struggle with when it comes to functional programming.