Skip to content

Instantly share code, notes, and snippets.

@pjullah
Last active July 4, 2017 12:00
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 pjullah/c5328d55bea3de5bf5d7867cf18fd725 to your computer and use it in GitHub Desktop.
Save pjullah/c5328d55bea3de5bf5d7867cf18fd725 to your computer and use it in GitHub Desktop.
Notes about Clojure
;; Lots of Clojure - http://matthiasnehlsen.com/
; best explanation of apply vs map - http://stackoverflow.com/questions/2311528/clojure-apply-vs-map
(apply F [1 2 3 4 5])
;translates to
(F 1 2 3 4 5)
(map F [1 2 3 4 5])
;translates to
[(F 1) (F 2) (F 3) (F 4) (F 5)]
; show vars in current ns
(keys (ns-publics (ns-name *ns*)))
(defn vec-contains?
"Check if vector col contains value search"
[col search]
(some #(= search %) col))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment