Search code examples
clojurecoding-stylenaming-conventions

clojure idiomatic name for impure function


In Clojure, functions that modify their input conventionally end with an ! to warn the user. I even extended this: two !! means that the function has a side effect that modifies something that was not put in (i.e. global states that must persist across user-GUI interactions).

What is the convention for a function that is impure in that it uses an external state, such as file loading, etc?


Solution

  • There is no such convention. Impurity should be apparent from the functions name or docstring or purpose.

    Examples:

    get-settings-from-file

    (get-settings :source :file)

    load-configuration

    import-data