| ▲ | 1718627440 3 hours ago | |||||||
> I don't know! A pure function is a function whose output only depends on the paramters and not has any internal state. Which in my opinion is a somewhat useless distinction, because you can make your state/instance/whatever the first parameter, (what C and Python do) and tada, every function that doesn't use globals (or static in C), is a pure function. | ||||||||
| ▲ | knome 2 hours ago | parent | next [-] | |||||||
a pure function doesn't have side effects. it doesn't read from nonlocal state or trigger distant changes nor perform any manner of io. a pure function doesn't change its inputs, it simply uses them to craft it's outputs. bringing in an object or function via parameter to perform these side effects still leaves the function impure. | ||||||||
| ▲ | sroerick 3 hours ago | parent | prev [-] | |||||||
Is that distinct from a pure transformation? | ||||||||
| ||||||||