This file contains hidden or 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
(ns ch3.core) | |
;;;;;;;;;;;;;; | |
;; Chapter 3 | |
;;;;;;;;;;;;;; | |
;; 리스트는 앞에 추가한다. | |
(def lst '(1 2 3)) | |
(conj lst 0) | |
(conj lst 0 -1) ; 여러개 추가 가능 |
This file contains hidden or 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
(java.util.UUID/randomUUID) |
This file contains hidden or 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
(defmacro ? [o prop] | |
(let [get-prop# (symbol (str "get-" prop))] | |
`(~get-prop# ~o))) | |
(defmacro ! [o prop val] | |
(let [set-prop# (symbol (str "set-" prop))] | |
`(~set-prop# ~o ~val))) | |
(defmacro def-access-method [field] | |
(let [get-method# (symbol (str "get-" field)) |
This file contains hidden or 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
;; (require '[clojure.string :as str] '[clojure.java.shell :as shell] '[taoensso.timbre :as timbre]) | |
(defn with-free-port! | |
"Attempts to kill any current port-binding process, then repeatedly executes | |
nullary `bind-port!-fn` (which must return logical true on successful | |
binding). Returns the function's result when successful, else throws an | |
exception. *nix only. | |
This idea courtesy of Feng Shen, Ref. http://goo.gl/kEolu." | |
[port bind-port!-fn & {:keys [max-attempts sleep-ms] |