Permalink
Fetching contributors…
Cannot retrieve contributors at this time
|
; P03 Find the Kth element of a list. |
|
|
|
; Tail recursion |
|
(defn f1 [l, n] |
|
(if (= n 1) |
|
(first l) |
|
(recur (rest l) (dec n)))) |
|
|
|
; Using index |
|
(defn f2 [l, n] |
|
(nth l (dec n))) |
You can't perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.