Fork me on GitHub
#clerk
<
2023-03-02
>
hlship00:03:28

I wonder if there's an easy way to make a Clerk notebook render somewhat like a Keynote presentation (one "page" at a time, with forward and back buttons)? I'm working on a tutorial that could benefit from that.

Sam Ritchie00:03:24

I think @mkvlr did get that working!

hlship01:03:46

Why are all my good ideas previously thought of? 😞

😆 6
Sam Ritchie03:03:48

Haha that’s how you know they’re good!!! Also the feature isn’t done yet (I think?) so it’s a good thing to bring up. I want it badly for my clojure conj talk

💯 10
hlship17:03:08

Already using it! First off, I can save a page as PDF, there's still some issues, but at least it's more than one page.

mkvlr17:03:48

can or can’t?

hlship17:03:00

It does save and mostly looks good, but some of the layout ends up with tabular layout on top of text layout.

hlship18:03:55

Some of the most fun I've had coding in the last few months has been in Clerk notebooks!

mkvlr18:03:24

oh thats music in my ears, thanks you!

kommen13:03:20

new release lines up very nicely with 1300 ️ on github

4
🚀 2
teodorlu13:03:53

Shower thought: I spent some time with SQLite yesterday, using https://sqlitebrowser.org/ to see what I was doing. If there was a Clerk-based alternative, I'd probably use that instead. (some-person.clerk-extras/db-browse datasource). I think jdbc.next has datafy+nav support for navigating through foreign keys.

💯 6
mkvlr17:03:56

it does, been wanting to support that better in clerk for a good while…

👀 2
genmeblog16:03:29

New version fails on some trivial case regarding constant double value

genmeblog16:03:02

(ns some
  (:require    [nextjournal.clerk :as clerk]))

(def ^:const ^double PI 3.14)

genmeblog16:03:36

Clerk evaluated '/home/.../some.clj' in 39.979623ms.
Execution error (ExceptionInfo) at clojure.tools.analyzer.passes.jvm.validate/eval16782$fn (validate.clj:189).
Wrong tag: clojure.core$double@4e0d541b in def: PI

mkvlr17:03:13

issue welcome, can take a look tomorrow

mkvlr17:03:19

is the annotation valid?

genmeblog17:03:37

Thanks! As far as I know annotation is valid, I'll verify it anyway.

mkvlr17:03:05

currently suspect it’s a side-effect of analyzing more code due to build-graph change from https://github.com/nextjournal/clerk/blob/b149f2f34370125b53acd809c32764f9d6c5a01d/CHANGELOG.md#013838-2023-03-02

genmeblog17:03:13

^double is valid and is the same as {:tag 'double}

genmeblog17:03:32

The problem is that if I use such symbol (defined in other namespace) I also get this error.

mkvlr17:03:39

is that a bug in tools analyzer then?

mkvlr17:03:58

(clojure.tools.analyzer.jvm/analyze '(def ^:const ^double PI 3.14) (clojure.tools.analyzer.jvm/empty-env) {})

mkvlr17:03:08

this is a minimal repro with only tools.analyzer

genmeblog18:03:49

oh, indeed, hmmm

genmeblog19:03:40

ok, it's my misuse of double tag in this case 😕

2
mkvlr14:03:36

ah right, meant to link this to the docs (which don’t exist yet)

👍 2
mkvlr17:03:51

☝️ the new nextjournal blog is also published with #C04ATSH4QNM

Sam Ritchie19:03:08

is there a form of clerk/example that I can use for tests? where the notebook runs an assertion that my output still matches the generated output? I am sure this has been asked

⬆️ 6
2
mkvlr19:03:43

not in clerk currently. Would like to see someone build it and then see if it’s something folks would want in clerk.

genmeblog19:03:57

for documentation purposes it would be great stuff (`notespace` and my metadoc supports this)

caleb.macdonaldblack19:03:27

Having a combined clerk and test suite is something I’m looking for also.

jackrusher07:03:30

We have built a clerk kaocha test thing internally, it's easy and doesn't take much code. It would be great if community members would give this a try for themselves. 🙂

genmeblog08:03:50

I think we speak about something slightly different. Kind of embedding tests into the notebook and connect them with examples. Quick and dirty:

(defmacro examples-with-test
  [& forms]
  `(clerk/table
    {:head ["test" "code" "result"]
     :rows [~@(for [[c f t] forms
                    :let [test-code `(clojure.test/is ~(if t `(~f ~c ~t) `(= ~f ~c)))]]
                `(let [t# ~test-code]
                   [(if t# "✅" "❌" ) (clerk/code (quote ~c)) (if t# ~c (str "Expected " ~(or t f) " got " ~c))]))]}))

(examples-with-test
 [(+ 1 2) 3]
 [(+ 3 4) 5]
 [(+ 5 (rand-int 10)) >= 5])

🔥 4
jackrusher10:03:22

And there you go, already a prototype 😄

😁 2
respatialized19:03:42

when using clerk/build! on a single file, can I derive the name of the output file from the input file?

respatialized19:03:52

I’d like a way to build individual notebooks without name clashes on index.html

respatialized20:03:50

Thinking a bit more about “publication” workflows with Clerk, it would be interesting if you could use metadata on specific forms to display them in interactive mode but exclude them from publication in a static app. That feature would be good for inline assertions/checks like the ones @sritchie09 described that don’t need to be published but should live inside the notebook.

⬆️ 2
👍 2