Skip to content

Commit 7c50989

Browse files
authored
[doc:README] bump for 0.3.0.5
1 parent 78c8d14 commit 7c50989

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,30 @@ Functions can be defined using the `defun` function, where the first argument is
7878
(print (get-goodbye "Matt" "evening")) ;; have a good evening, Matt
7979
```
8080

81+
Functions can have variadic arguments:
82+
```clojure
83+
(defun variadic-example [(ability: string) &(more: string)] {
84+
(print "Axolotl can also do " ability)
85+
(print "Here are the remaining arguments: " more)
86+
})
87+
88+
(variadic-example "variadic functions!" "abcd" "efgh" "ijkl" "mnop")
89+
90+
; output:
91+
; Axolotl can also do variadic functions!
92+
; Here are the remaining arguments: ["efgh","ijkl","mnop"]
93+
```
94+
95+
Functions can be recursive, but make sure to manually define to return type, because it isn't possible to infer types mid-function yet:
96+
```clojure
97+
(defun (factorial: int) [(num: int)] {
98+
(if (== num 1) 1 (* num (factorial (- num 1))))
99+
})
100+
101+
(print (factorial 5))
102+
; outputs 120
103+
```
104+
81105
## Mathematical Functions
82106
Only the operators +, -, * and / are available for now, each is a function that can take any number of arguments.
83107

0 commit comments

Comments
 (0)