Fork me on GitHub

Oh cool. Makes sense

Rob Haisfield01:07:54

Structural editors like Paredit and Parinfer make the claim that it makes more sense to manipulate Lisp / Clojure code by the expression instead of by the line... is there an equivalent to Grep / Ripgrep that queries Lisp code by the expression instead of by the line?


another borkdude project already has you covered,

‼️ 11
Rob Haisfield01:07:43

Hmm I’m not sure what it means to grep using Clojure.spec regexes

Rob Haisfield01:07:18

Is it basically that I write a predicate function and it finds s-expressions that match?

👍 3

regular expressions are almost always used to match against strings, but the regular expression operators (`*`, alt, +, etc) are really more generically about the order of stuff in a sequence. here's the spec docs,


as an example of using regex against data, you could have a predicate that is a number, followed by a string, followed by 0 or more keywords:

;; :my-number, :my-str, :my-keywords are simply labels/documentation
(s/cat :my-number number
       :my-str string?
       :my-keywords (s/* keyword?))

👍 3

I want to show the app version on the front page of my app. Where do I collect that information from? I’m using deps.edn and and update the pom.xml with version


I guess I could, just never handled xml in clojure. Can use regex, but was wondering if there was a more “elegant” way 😄

oxalorg (Mitesh)08:07:43

We sometimes use this when doing git based deploys:

(defn get-version [_]
  (let [commit (-> (sh/sh "git" "rev-parse" "HEAD") :out string/trim)]
    {:status 200
     :body {:commit commit}
     :view #(:commit %)}))


Is this correct: when using e.g. extend-type with a record type (defined in another namespace), I need to use :import and refer to the generated Java class, e.g. (ns foo (:import [some.other_namespace NameOfRecord]))?

Edward Ciafardini13:07:55

I'm about to start working on a project that takes text documents and alters their format based on user inputs. Any libraries or functions you would recommend looking into? One example of what I'd be trying to do it taking text: This is is text then displaying it as T h i s i s t e x t There are lots of other patterns I want to try to implement too

Martin Půda14:07:44

Check clojure.string and clojure.pprint- your example can be achieved with (clojure.string/join "\n" "This is text") or, if you are familiar with Common Lisp format, with (clojure.pprint/cl-format false "{a^%~}" "This is text"). Use println for displaying that string in REPL.

Kenneth Gitere18:07:32

Hi I have a couple of functions as defn bindings that have destructuring on the arguments. This makes the documentation pretty ugly as the destructuring is visible. Is there a way to tweak the metadata of a defn binding to not show the destructured args or will I need to make a let binding?


I actually usually like the destructuring appearing in the docstring but you can set your own arglists as shown here on (defn eduction ...)

Kenneth Gitere18:07:07

Thanks :thumbsup:


(defn- … with the dash is a private function?


Ooh the ^:private is a lot more in one’s face…


is there a name for the ^: dealio ? I see the phrase type hinting thrown around a lot