Created
July 21, 2014 15:18
-
-
Save Diullei/315a2b2c8e513056edd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn my-last [xs] | |
(if (= (count xs) 1) | |
(first xs) | |
(my-last (rest xs)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(use '[clojure.core.match :only (match)])
(defn my-last [xs](match [%28count xs%29]
[1] %28first xs%29
:else %28my-last %28rest xs%29%29))