We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3057fac commit 96787f8Copy full SHA for 96787f8
22.clj
@@ -0,0 +1,15 @@
1
+;; Title: Count a sequence
2
+;; Link: http://www.4clojure.com/problem/22
3
+;; Description: Write a function which returns the total number of elements in a sequence.
4
+
5
+;; QUESTION/TEST CODE
6
7
+;; (= (__ '(1 2 3 3 1)) 5)
8
+;; (= (__ "Hello World") 11)
9
+;; (= (__ [[1 2] [3 4] [5 6]]) 3)
10
+;; (= (__ '(13)) 1)
11
+;; (= (__ '(:a :b :c)) 3)
12
13
+;; SOLUTION CODE
14
15
+#(reduce (fn [value coll] (inc value)) 0 %)
0 commit comments