basic callbacks… (comment "basic callback" (let [callback-fn #(+ 5 %) ] (callback-fn 10)) ) … user=> (let [callback-fn #(+ 5 %) #_=> ] #_=> (callback-fn 10)) 15 callback w future (comment "future w callback func" (defn use-callback-when-done [callback-fn] (future (callback-fn (+ 4 5)))) (def output (use-callback-when-done #(println "printings.. " % " .end"))) ) => user=> (def output (use-callback-when-done #(println "printings.. " % " .end"))) #'user/output printings.. 9 .end user=> callback and core async… (comment "use a go put onto a channel callback....

(updated February 26, 2023) · 1 min · 179 words · Michal Piekarczyk

(Porting over my notes from gists .. here ),.. quick note on imports i originally inferred this (ns blah-namespace (:use clojure.core.blah ) ; this would take all the terms in blah and put them into the current namespace (:refer-clojure :exclude [blarg flarg]) ; but this is supposed to be a way to avoid term clash ; so blarg and flarg will not be used. (not that they are in clojure.core however) ) Then I read https://www....

(updated February 26, 2023) · 9 min · 1908 words · Michal Piekarczyk

keys keywords from map (let [ {:keys [status headers body error]} {:status 0 :headers 1 :body 3 :error 5 :extra 88} ] (println status body) ) your.app=> (let [ #_=> {:keys [status headers body error]} {:status 0 :headers 1 :body 3 :error 5 :extra 88} #_=> ] #_=> (println status body) #_=> ) 0 3 nil your.app=> also keyword args arity (comment "" (defn foof [a b & {:keys [op-fn] :or {op-fn +}}] (op-fn a b)) (foof 4 5 :op-fn *) (foof 4 5 :op-fn #(str %1 "....

(updated February 26, 2023) · 1 min · 90 words · Michal Piekarczyk

print data structures so as to preserve quotation (quotes) wow .. took too long to come across this nugget https://stackoverflow.com/questions/21136766/clojure-printing-functions-pr-vs-print pr/prn is to print/println for human readability. user=> (def d1 {:foo {:nil true :and "yay"}}) #'user/d1 user=> (prn "ok... " d1) "ok... " {:foo {:nil true, :and "yay"}} nil

(updated February 26, 2023) · 1 min · 49 words · Michal Piekarczyk

Dependencies and the repl It appears adding new dependencies into the build.boot file, and then running boot local repl again, downloads required dependencies and makes them useable for in the project. directory structure for a project my-project-root/ VERSION build.boot src/ blah/ foo.clj blarth.clj

(updated February 26, 2023) · 1 min · 43 words · Michal Piekarczyk