In clojure.core, an ending "!" indicates a function that is unsafe for STM,
rather than one with side effects. For instance, alter and send are
functions with side effects, but have no ending "!" because they're safe to
use in a dosync block.

In other words, an ending "!" indicates a function has side effects that
are not idempotent.

- James


On 10 July 2014 16:28, Cecil Westerhof <cldwester...@gmail.com> wrote:

> When a function returns a true/false value you should end it with a '?'.
>
> Clojure Programming says that with side effects you should end the
> function name with a '!'.
>
> I have functions reset-game! and walk!. But what about a function like
> look? It does not change state, but it displays where you are. So it has a
> side effect. But most of my functions have this. So, should I append them
> all with a '!'?
>
> --
> Cecil Westerhof
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to