Skip to content

Commit f1c6017

Browse files
author
Jani Rahkola
committed
Added exercise 'singleton?'.
1 parent 3a590e4 commit f1c6017

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/recursion.clj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
(defn product [coll]
44
:-)
55

6+
(defn singleton? [coll]
7+
:-)
8+
69
(defn last-element [coll]
710
:-)
811

test/recursion_test.clj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
(product [0 1 2]) => 0
1010
(product #{2 3 4}) => 24)
1111

12+
(facts "singleton?"
13+
(singleton? [1]) => true
14+
(singleton? #{2}) => true
15+
(singleton? []) => false
16+
(singleton? [1 2 3]) => false)
17+
1218
(facts "last-element"
1319
(last-element []) => nil
1420
(last-element [1 2 3]) => 3

0 commit comments

Comments
 (0)