How is println function not clean? (Clojure)

It always returns nil .

Doesn't that mean it's clean?

Does println cause any side effects?

+6
source share
2 answers

Side effects can be roughly defined as "a change in any state that is not contained in the function itself." This includes writing to disk or calling some external API, etc. Since it printlnwrites to STDOUT, it changes the state of stdout. Therefore, it has a side effect.

+6
source

It always returns nil .

Doesn't that mean it's clean?

This means that it is clean if it has no side effects.

Does println cause any side effects?

Yes, he is typing.

, , .

. , ( ) . , println IFF. println nil nil println . , , ergo, println /.

+4

All Articles