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 99a5838 commit 3057facCopy full SHA for 3057fac
21.clj
@@ -0,0 +1,14 @@
1
+;; Title: Nth Element
2
+;; Link: http://www.4clojure.com/problem/21
3
+;; Description: Write a function which returns the Nth element from a sequence.
4
+
5
+;; QUESTION/TEST CODE
6
7
+;; (= (__ '(4 5 6 7) 2) 6)
8
+;; (= (__ [:a :b :c] 0) :a)
9
+;; (= (__ [1 2 3 4] 1) 2)
10
+;; (= (__ '([1 2] [3 4] [5 6]) 2) [5 6])
11
12
+;; SOLUTION CODE
13
14
+#(last (take (inc %2) %))
0 commit comments