Created
February 18, 2016 20:20
-
-
Save mgandin/0cbadf6eb12e6e2e6e0b to your computer and use it in GitHub Desktop.
Small examples in Clojure
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
(println "Clojure FTW !") | |
(+ 1 1) | |
(* (/ 2 4) (/ 4 2)) | |
(+ 2 2 2 2) | |
(/ 8 2 2) | |
(- 8 1 2) | |
(= 1 1) | |
(< 1 2) | |
(< 1 2 3) | |
(< 1 3 2) | |
(> 42 41) | |
(str "the universal response is " 42) | |
(if (< 1 2) | |
(println "1 < 2")) | |
(= (list 1 2 3) '(1 2 3)) | |
(defn hello [name] | |
(str "hello, " name)) | |
(hello "Mathieu") | |
(def map1 [:one :two :three]) | |
(def map2 [:four :five :six]) | |
(defn first-map [aMap] (first aMap)) | |
(first-map map1) | |
(let [a 1 | |
b a] (+ a b)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment