This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-28
Channels
- # aleph (3)
- # babashka (66)
- # beginners (96)
- # calva (45)
- # clj-kondo (28)
- # clojure (30)
- # clojure-dev (2)
- # clojure-europe (20)
- # clojure-germany (22)
- # clojure-norway (4)
- # clojurescript (176)
- # clojutre (1)
- # cursive (23)
- # datalog (6)
- # datomic (7)
- # docker (3)
- # emacs (3)
- # exercism (4)
- # figwheel-main (5)
- # fulcro (8)
- # gratitude (9)
- # hyperfiddle (8)
- # introduce-yourself (2)
- # jobs (2)
- # malli (4)
- # membrane (3)
- # off-topic (17)
- # polylith (3)
- # portal (2)
- # re-frame (27)
- # reitit (3)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (152)
- # spacemacs (8)
- # tools-deps (15)
- # vscode (1)
- # xtdb (24)
A potentially very nice minor convention with RCF to document our intentions when building small utils.
Of course we should write a docstring too.
Something like this.
(defn join-not-blank
"Like clojure's str/join but does not separate str/blank? vals in coll.
`(join-not-blank \"🧱\" [\"a\" \"\" nil \"b\"]) := \"a🧱\"`"
([coll]
(str/join (remove str/blank? coll)))
([separator coll]
(str/join separator (remove str/blank? coll))))
(rcf/tests
;; What we didn't like about str/join...
(str/join "🧱" ["a" "" nil "b"]) := "a🧱🧱🧱"
;; So we built this...
(join-not-blank "🧱" ["a" "" nil "b"]) := "a🧱b"
(join-not-blank ["a" "" nil "b"]) := "ab"
(join-not-blank "🧱" []) := ""
(join-not-blank []) := ""
;;
)
Gotta make time to create an utility to auto-append RCF tests to the end of function docstrings!
Yeah it would be great to integrate with docstrings etc; it also might be possible to get editors to offer an interface for examples, RCF could set :tests meta on vars
I will explore solutions external to RCF. If I reach some learnings about IDE UIs that might be useful to RCF too, I might ping you in e.g. #calva where I'll show some things to these folks.
Could be worth looking at now CIDER for example can display specs alongside docstrings
Geoffrey is already up to date on this but here's the entire code of my current prototype. I'm stopping improving it for a number of weeks (focusing on something else), but we're already satisfied with the following... With this, RCF tests can now (still) be auto-executed, but also auto-added to VS Code Calva's doc hover tooltips. https://clojurians.slack.com/archives/CBE668G4R/p1651609025359479?thread_ts=1651259227.960969&cid=CBE668G4R
Gotta make time to create an utility to auto-append RCF tests to the end of function docstrings!