;; Connected to nREPL server - nrepl://localhost:42827 ;; CIDER 0.14.0snapshot (package: 20161013.518), nREPL 0.2.10 ;; Clojure 1.7.0, Java 1.8.0_102 ;; Docs: (doc function-name) ;; (find-doc part-of-name) ;; Source: (source function-name) ;; Javadoc: (javadoc java-object-or-class) ;; Exit: ;; Results: Stored in vars *1, *2, *3, an exception in *e; ;; ====================================================================== ;; If you're new to CIDER it is highly recommended to go through its ;; manual first. Type to view it. ;; In case you're seeing any warnings you should consult the manual's ;; "Troubleshooting" section. ;; ;; Here are few tips to get you started: ;; ;; * Press to see a list of the keybindings available (this ;; will work in every Emacs buffer) ;; * Press <, ,> to quickly invoke some REPL command ;; * Press <, s s> to switch between the REPL and a Clojure file ;; * Press to jump to the source of something (e.g. a var, a ;; Java method) ;; * Press <, h h> to view the documentation for something (e.g. ;; a var, a Java method) ;; * Enable `eldoc-mode' to display function & method signatures in the minibuffer. ;; * Print CIDER's refcard and keep it close to your keyboard. ;; ;; CIDER is super customizable - try to ;; get a feel for this. If you're thirsty for knowledge you should try ;; . ;; ;; If you think you've encountered a bug (or have some suggestions for ;; improvements) use to report it. ;; ;; Above all else - don't panic! In case of an emergency - procure ;; some (hard) cider and enjoy it responsibly! ;; ;; You can remove this message with the `cider-repl-clear-help-banner' command. ;; You can disable it from appearing on start by setting ;; `cider-repl-display-help-banner' to nil. ;; ====================================================================== WARNING: CIDER requires nREPL 0.2.12 (or newer) to work properly More information. WARNING: CIDER's version (0.14.0-snapshot) does not match cider-nrepl's version (nil). Things will break! More information. WARNING: clj-refactor and refactor-nrepl are out of sync. Their versions are 2.3.0-SNAPSHOT (package: 20161005.344) and n/a, respectively. You can mute this warning by changing cljr-suppress-middleware-warnings. user> (into '() [2 3 4 5]) (5 4 3 2) user> (def v1 [2 3 4 5]) #'user/v1 user> (into v1 [30 40 50]) [2 3 4 5 30 40 50] user> (conj v1 10) [2 3 4 5 10] user> v1 [2 3 4 5] user> (count v1) 4 user> (v1 0) 2 user> (map v1 '(3 1 2)) (5 3 4) user> (rest v1) (3 4 5) user> (def v1 [1 3 5 7 2 4 6]) #'user/v1 user> (filterv #(> % 5) v1) [7 6] user> (filterv #(<= % 5) v1) [1 3 5 2 4] user> (defn greater-than-five [x] (> x 5)) #'user/greater-than-five user> ( #(> % 123) 12) false user> ( #(> % 123) 1233) true user> (inc 123) 124 user> (def s1 #{10 20 30}) #'user/s1 user> s1 #{20 30 10} user> (s1 10) 10 user> (filter s1 [5 10 15 20 25]) (10 20) user> (filterv s1 [5 10 15 20 25]) [10 20] user> (if (empty? nil) 'do-true-thing 'do-false-thing) do-true-thing user> (reduce + 0 '(1 2 3)) 6 user> (reduce (fn [a b] (str "(" a " " b ")")) "x" '(1 2 3)) "(((x 1) 2) 3)" user> (def h1 {:name "Gollum" :salary 13 :title "Coder"}) #'user/h1 user> (h1 :title) "Coder" user> (def h1 {:name "Gollum", :salary 13, :title "Coder"}) #'user/h1 user> (assoc h1 :hobby "Weiqi") {:name "Gollum", :salary 13, :title "Coder", :hobby "Weiqi"} user> (def num-zeros [v] (count (filter zero? v))) CompilerException java.lang.RuntimeException: Too many arguments to def, compiling:(/tmp/form-init8244059015719196079.clj:1:1) user> (defn num-zeros [v] (count (filter zero? v))) #'user/num-zeros user> (num-zeros [1 0 2 0 3 0 4]) 3 user> (defn list-to-set [ll] (into #{} ll)) #'user/list-to-set user> (list-to-set '8 6 7 5 3 0 9) ArityException Wrong number of args (7) passed to: user/list-to-set clojure.lang.AFn.throwArity (AFn.java:429) user> (list-to-set '(8 6 7 5 3 0 9)) #{0 7 6 3 9 5 8} user> (def employees [{:name "Fred" :salary 10} {:name "Gollum" :salary 20} {:name "Judy" :salary 123123123}]) #'user/employees user> (defn salary-of [emps name] (filterv #(= name (:name %)) emps))) #'user/salary-ofRuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221) user> (defn salary-of [emps name] (filterv #(= name (:name %)) emps)) #'user/salary-of user> (salary-of employees "Fred") [{:name "Fred", :salary 10}] user> (defn salary-of [emps name] (map :salary (filterv #(= name (:name %)) emps)))