is foo += 1 considered functional?
Was thinking of creating a CONS function to create a list, but then realized that im not mutating any state with foo += 1, since its == foo = foo + 1 which is a new ob开发者_开发问答ject
The state is changed: the value referenced with the variable foo
changes.
This is "not functional" in any pure sense. I might be tempted to call it "confusing" ;-)
Happy coding.
精彩评论