This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-18
Channels
- # announcements (5)
- # aws (4)
- # babashka (30)
- # beginners (90)
- # calva (31)
- # clj-on-windows (16)
- # clojure (110)
- # clojure-dev (10)
- # clojure-europe (26)
- # clojure-nl (1)
- # clojure-norway (20)
- # clojure-spec (25)
- # clojure-uk (15)
- # clojured (2)
- # clojurescript (12)
- # code-reviews (2)
- # community-development (3)
- # conjure (14)
- # datomic (26)
- # defnpodcast (2)
- # events (1)
- # fulcro (17)
- # graalvm (8)
- # gratitude (1)
- # introduce-yourself (2)
- # jobs-discuss (7)
- # kaocha (6)
- # lsp (9)
- # luminus (5)
- # nextjournal (7)
- # observability (9)
- # off-topic (71)
- # portal (5)
- # practicalli (1)
- # rdf (21)
- # re-frame (15)
- # releases (1)
- # shadow-cljs (24)
- # testing (7)
- # tools-build (13)
- # tools-deps (14)
- # xtdb (7)
So I just wrote this monster and am wondering if there’s a smarter / cleaner way to do these kinds of things:
(defn- process-paragraph [section-string]
(->> (some-> (re-find #"\*((.|\n)*?)\*" section-string)
second
(str/split #", "))
(map #(str/replace % #"\(((.|\n)*?)\)" ",$1"))
(mapcat #(let [[x & xs] (str/split % #",")]
(if xs
(map (fn [num] (str x num)) xs)
[x])))))
(process-paragraph "ignore, *3.5(a)(b)(c)(d)(e), 3.6*")
;; => ("3.5a" "3.5b" "3.5c" "3.5d" "3.5e" "3.6")