This file contains 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
(defn builder | |
([^StringBuilder sb] | |
(fn | |
([] (.toString sb)) | |
([& args] | |
(doseq [arg args] | |
(.append sb arg))))) | |
([] (builder (StringBuilder.)))) | |
(comment |
This file contains 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 autostub | |
(require [clojure.string :as string])) | |
(set! *compile-path* "build/classes") | |
(defn export? [[var-symbol var-value]] | |
(and (fn? (var-get var-value)) ;; functions only | |
(not (.contains (str var-symbol) "->")))) ;; ignore record auto generated functions | |
(defn stub-fun-name [name] |
This file contains 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
user=> (def buffer (StringBuilder.)) | |
#'user/buffer | |
user=> | |
(defn appender [^StringBuilder buffer] | |
(fn [& args] | |
(when-let [arg (first args)] | |
(.append buffer arg) | |
(recur (rest args))))) | |
user=> #'user/appender | |
user=> |