Login
7 branches 0 tags
Ben (X13/Arch) Simplified things a little 0643405 9 days ago 1260 Commits
nujel / docs / stable / 1.8-functions.md

[ 1.7 - Quote & Quasiquote | Overview ]


Functions

Functions use defn and fn, just like Clojure, however we can freely choose where we want to use brackets and parentheses. Variadic functions also use the scheme notation with a dotted pair, or omitting the brackets altogether.

[defn double [α] [* α α]]
[double 2]
; => 4

[defn multiply-vals [val . l]
      [map l [fn [v] [* v val]]]]
[multiply-vals 2 1 2 3]
; => [2 4 6]

[defn my-list l l]
[my-list 1 2 3 4]
; => [1 2 3 4]

[ 1.7 - Quote & Quasiquote | Overview ]