Clojure methods ending in *

What is the difference between methods ending in * ? I have seen a few, but have no idea if this is an established naming convention.

+4
source share
2 answers

In general, I saw that it was used to distinguish between functions that do the same, but with different signatures, especially in situations where overloads would create conflicting semantics. For example, list* cannot be expressed as an overload of list , because they use the arity variable in many ways.

In many cases (but not all), the form * is called by the version not * .

+2
source

In addition to what was mentioned in other answers, this convention is used where the non-version is macros, and these macros emit code that calls functions *. Even in clojure.core , let and fn are macros that have received let* and fn* calls as a result of the code, respectively. Another example: sqlkorma , where non * ( where , delete , update , etc.) are macros and * units ( where* , delete* , etc.) are functions.

The reason for using this template is that in some cases it is not practical to use the version of the API macro (other than using eval, since you have no information at compile time), in such cases you can use the * functions.

+2
source

All Articles