File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -83,14 +83,28 @@ Each global function can take an optional doc comment and attribute map.
8383 "adds value a and b"
8484 [a b]
8585 (+ a b))
86+ ```
87+
88+ ### Private functions
89+
90+ Private functions are not exported from the namespace and cannot be accessed from other namespaces. You can create private functions in two ways:
8691
92+ 1 . Using the ` {:private true} ` attribute map
93+ 2 . Using the ` defn- ` shorthand
94+
95+ ``` phel
8796(defn my-private-add-function
88- "adds value a and b"
8997 {:private true}
9098 [a b]
9199 (+ a b))
100+
101+ (defn- my-private-add-function
102+ [a b]
103+ (+ a b))
92104```
93105
106+ Both approaches are equivalent, but ` defn- ` provides a more concise syntax for defining private functions.
107+
94108## Recursion
95109
96110Similar to ` loop ` , functions can be made recursive using ` recur ` .
You can’t perform that action at this time.
0 commit comments