Skip to content

Instantly share code, notes, and snippets.

@jboverfelt
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jboverfelt/d8292d0a3e408906563d to your computer and use it in GitHub Desktop.
Save jboverfelt/d8292d0a3e408906563d to your computer and use it in GitHub Desktop.
whirlwind-clojure.clj
; clojure has all the basic datatypes - string, double, float, boolean
; it also has symbols, keywords, and nil instead of Java's null
; a symbol (an identifier that usually refers to something else
'test
; a keyword (generally used in maps and for "enum" like values)
:foo
; Data Structures
; vector (sequential, add new values at end)
[1 2 3]
; list (clojure code is made up of lists, sequential
'(1 2 3)
; map (hash map)
{:foo bar :test 123}
; set
#{1 2 3}
; functions (it's a list!)
; general form
(defn function [arg arg arg ...]
...)
(function arg arg arg)
(defn add-2 [other]
(+ 2 other))
(add-2 3) ; => 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment