Morning
mogge
good morning
Good Morning!
I live right across the largest concert hall in Copenhagen and Radiohead happens to be playing there tonight (unless they cancel again). My brother-in-law and his girlfriend are staying at our place tonight since they are going to that concert. I am a little bit enviousβ¦
@simongray since you're not going to the concert, I guess it's just ok, computer for you today.
morning all! Yesterday, I learned that @dasluβs brain got started on how to make https://github.com/scicloj/clay/ during a pair programming session with Michiel and me after the first Babashka conf. Daniel and I thought of notebooks as something magical and complex, but no, "just read the namespace, eval the forms and present". Weird how one event influences a different event!
I still remember that. Didn't clay exist before that? That's amazing to hear. I just updated the https://babashka.org/conf/ site with some preliminary info an hour ago since it will be listed in the Clojure Deref
Both Daniel and I are coming π
so excited :)
I was thinking about encouraging some pre and post conference activities organized by the community. Like: β’ Informal hacking session in coffee place β’ Escape room (with time limit... since we don't want to miss the conference) β’ Brunch β’ Post-conference dinner groups (1 person reserves table at restaurant, holds up sign after conference, when group is full they leave, we can have 10 of those groups). Then join for beers after dinner in some adjacently located pubs. Then next day DCD
Wow, stoked to meet you all. I'm having lots of fun working on Clay now. So thanks @borkdude I guess. π
it was an organic back and forth behind a laptop in a coffee place on a warm day so I don't remember most of what I said but I'm glad something useful came out of it :)
Yes, that day was really the inspiration to the major refactoring Clay went through, resulting in the current form of Clay v2, that was later crafted together with Timothy Pratley and friends. One thing we drafted was code-reading with rewrite-clj for Babashka support, but this remained a draft, that will probably be merged soon by @onbreath , closing the circle.
ah yes, I remember we played around with rewrite-clj in that cafe
why is this specific to babashka?
btw meanwhile, Clerk now runs in bb. (a PR which only took 3 years :))
the main goal was to support Babashka :)
Yes, great to see that in Clerk β€οΈ
@daslu can you remind me what the problem was with bb support in normal clay?
(edit: clay)
I think a few dependencies are not bb friendly, and one of them is Parcera, that can be replaced with rewrite-clj.
right
From what we're doing now, I'd say integrating the babashka compatible read+eval with clay, while assuring backwards compatibility with every notebook already written for the Clojure side, was a big blocker. That's soon solved or testable with a diff on internal representation and rendered output of notebooks based on Clojure civitas posts, books and documentation for some projects. Lots of notes to compare that do all sorts of stuff. Kind of nice when a test suite writes "itself", or rather, all the great people who did in fact.
do you use parcera or rewrite-clj just to get a literal rendering of the code as written?
or do you also analyze that stuff somehow. nowadays you can also use read+string to get a form + the string read back. edamame supports it too
oh I see
;; We use parcera only for specific types of
;; code blocks, that tools.reader does not
;; provide location info for.
(some->> (when (#{:number :string :symbol :keyword :comment}
node-type)
{:code (first node-contents)})I think you could maybe do this only by tools.reader by reading the line/column of the reader before you read the next form (or faster). combined with read+string this gives you the literal string representation
edamame also offers workarounds for the location problem
like this: https://github.com/borkdude/edamame?tab=readme-ov-file#postprocess
here's an example of source preservation:
user=> (map meta (e/parse-string-all "(+ 1 2 3)" {:source true}))
({:source "(+ 1 2 3)", :row 1, :col 1, :end-row 1, :end-col 10})but this may also work for you:
user=> (def rdr (e/reader ":hello"))
#'user/rdr
user=> (e/get-line-number rdr)
1
user=> (e/get-column-number rdr)
1
user=> (e/parse-next rdr)
:hello
user=> (e/get-column-number rdr)
7
user=> (e/get-line-number rdr)
1Oh nice! π
Thanks for looking into this @borkdude. The new implementation with rewrite-clj is https://github.com/scicloj/read-kinds/blob/b5183d654affd540e2fb078dfed3cdc05959c028/src/scicloj/read_kinds/read.clj#L106 and there's a WIP-PR adding more of clays features. But of course we don't use the write part and not even the zippers of rewrite-clj. Edamame doesn't parse comments apparently, that'd be missing for us at least. I'll have to see if we need any of its other features. rewrite-clj seems to work quite well so far for parsing, but I haven't looked into all the edge cases yet. Also, it is not quite clear to me what the difference is between the two, beyond no code rewriting.
@onbreath do you mean ;; ? tools.reader doesn't do that either
"between the two", what two do you mean?
rewrite-clj and edamame.
rewrite-clj parses ;;, which is quite convenient for us yea.
if you mean edamame vs rewrite-clj: this is apples and oranges. you should compare edamame to tools.reader, it's basically the same idea but way more configurable
Aha okay, thanks
do you support the same comment -> markdown idea as clerk maybe?
I guess yes
I was confused since you use both parcera and tools.reader and sometimes pick one or the other result
That was the old implementation to prevent a reader bug. It is being superseded by rewrite-clj. Under the hood it used tools.reader too I think.
true
is this the old one? https://github.com/scicloj/clay/blob/847c9d66d9e46f15be5d6c2508148cff608317ae/src/scicloj/clay/v2/read.clj#L4 I guess with old you still mean the main branch?
Yes old in the sense that it will be removed when new is fully implemented and tested.
morning
good morning
Good Thrsdy morning
Good morning!