This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-05
Channels
- # announcements (15)
- # aws (7)
- # babashka (105)
- # beginners (35)
- # biff (5)
- # calva (48)
- # cider (5)
- # clj-kondo (25)
- # cljdoc (14)
- # clojure (84)
- # clojure-czech (2)
- # clojure-dev (6)
- # clojure-europe (58)
- # clojure-nl (6)
- # clojure-norway (19)
- # clojure-portugal (2)
- # clojure-uk (5)
- # clojurescript (23)
- # cloverage (5)
- # code-reviews (5)
- # conjure (28)
- # data-science (1)
- # datomic (53)
- # events (6)
- # exercism (7)
- # fulcro (16)
- # graalvm-mobile (2)
- # honeysql (29)
- # improve-getting-started (2)
- # kaocha (32)
- # lambdaisland (2)
- # lsp (29)
- # malli (3)
- # overtone (1)
- # pedestal (8)
- # polylith (3)
- # portal (6)
- # quil (2)
- # rdf (15)
- # releases (2)
- # rewrite-clj (14)
- # sci (9)
- # shadow-cljs (7)
- # specter (5)
- # sql (5)
- # xtdb (38)
Hey, folks! I'm taking a look at rewrite-clj from a perspective of a tool that allows to have Clojure programs as data, as I'm curious about this idea and about an interface to manage such data that would allow to complement my beloved emacs. 🙂 rewrite-clj can read a Clojure program and gives zipper and pareddit interface - that's a nice start!
I'm curious, can a whole Clojure program with all its Clojure dependencies be read as data?
E.g., read Clojure program as data, fetch its Clojure dependencies, repeat
Sure, why not, as long as you implement fetching the deps etc. yourself: any Clojure program as string can be read with rewrite-clj
What problem would your tool solve? There may already be tools out there that could help you
I'm curious about it because text-based management of today relies on names (places) to link together a program.
E.g., code
is given a name some-ns/some-def
and anybody who wants code
refers to its name, that resolves to code
at last at run-time.
Lately I've taken look at UnisonWeb, they have program as an immutable structure with names as user-level entities, allowing to label parts of that immutable structure to make sense of it as one sees fit (they have personal dictionaries of content = label
, so one person can label code of reduce
as foldl
, another as Map
- it's a personal view of data).
I'm curious to have a similar approach for Clojure programs.
For that, it seems to me, we could read program as data and decompose code
from labels
(names).
If anybody's curious about reasoning on this problem, https://clojurians.slack.com/archives/C053AK3F9/p1648500209863569.
But it's size is way out of hand. 😄
Are there any tools that could be building blocks for such a solution?
There are static analysis tools like clj-kondo which can retrieve data from pieces of clojure code. It's based on rewrite-clj. https://github.com/clj-kondo/clj-kondo/blob/master/analysis/README.md
> There is also tools.analyzer which can return an AST as EDN from Clojure programs. That sounds interesting, I'll take a look. Thanks. 🙂
Editor tooling like clojure-lsp is built on the clj-kondo analysis. Depending on what you want that may be already enough
clj-kondo seems to derive semantical information out of syntactic information rewrite-clj provides, that'll be of use!