This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-11
Channels
- # announcements (6)
- # architecture (14)
- # babashka (26)
- # beginners (22)
- # calva (11)
- # clj-kondo (2)
- # clj-on-windows (1)
- # cljsrn (10)
- # clojure (116)
- # clojure-europe (5)
- # clojure-uk (1)
- # clojurescript (5)
- # cursive (9)
- # datomic (21)
- # depstar (1)
- # events (1)
- # fulcro (2)
- # graalvm (17)
- # graalvm-mobile (28)
- # helix (3)
- # introduce-yourself (2)
- # jobs (2)
- # lsp (4)
- # meander (1)
- # off-topic (4)
- # pathom (5)
- # polylith (6)
- # practicalli (5)
- # reagent (67)
- # reitit (1)
- # releases (2)
- # shadow-cljs (24)
- # tools-deps (23)
Oh cool. Makes sense
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, https://github.com/borkdude/grasp
Hmm I’m not sure what it means to grep using Clojure.spec regexes
Is it basically that I write a predicate function and it finds s-expressions that match?
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, https://clojure.org/guides/spec#_sequences
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?))
Thank you!
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 😄
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]))
?
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
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.
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?
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L7719-L7727 you can set your own metadata
I actually usually like the destructuring appearing in the docstring but you can set your own arglists as shown here on (defn eduction ...)
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