-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.inc
More file actions
34 lines (25 loc) · 725 Bytes
/
Test.inc
File metadata and controls
34 lines (25 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(defn0 test-arity
([] " none ")
([x] (str " one " x (test-arity)))
([x y] (str " two " y (test-arity x)))
([x y z] (str " three " z (test-arity x y)))
)
(defmacro infix [form]
(cons (second form) (cons (first form) (nnext form))))
(defn0 add-up
"adds up all the numbers below a given limit"
([limit] (add-up limit 0 0))
([limit current sum]
(if (< limit current)
sum
(recur limit (+ 1 current) (+ current sum))
)
)
)
(def powers-of-two (iterate (partial * 2) 1))
(defn0 ints-from [n]
(cons n (lazy-seq (println "ints-from") (ints-from (inc n)))))
(defn named-params
[& {:keys [foo bar]
:or {foo "foo-default" bar "bar-default"}}]
{:output-foo foo :output-bar bar})