Fork me on GitHub
#clerk
<
2023-01-26
>
pfeodrippe05:01:56

Look ma, I will try to use (a customized) Clerk to build proper documentation (https://recife.pfeodrippe.com) for https://github.com/pfeodrippe/recife. No gap between code and documentation, they are only one now, think -> write. I will also try to blog using Clerk, it seems that we can go pretty far with it hauaheuuaeh

❤️ 12
Ben Sless06:01:35

Weird rendering on mobile 🧵

Ben Sless06:01:59

Brave browser on Android

pfeodrippe06:01:16

Yep, not supporting mobile very well yet, thanks for the report o/ Need to work on responsiveness

pfeodrippe23:01:54

Things should be better now, Ben o/ Thanks

👍 2
Ben Sless07:01:07

Works!

🎉 2
genmeblog11:01:44

I have really strange behaviour when I render custom html divs.

genmeblog11:01:28

This piece of code stops rendering Clerk (resulting page is empty)

(clerk/html
 [:div (list [:div 1] [:div 2] [:div 3])])

genmeblog11:01:59

while this works

(clerk/html
 [:div (list [:div 1] [:div 2])])

genmeblog12:01:12

In general odd number of nested divs, greater than two, makes resulting page empty

genmeblog12:01:16

The problem was introduced in 0.12.699

genmeblog12:01:29

0.11.603 works

mkvlr14:01:34

thanks for the issue, will take a look

genmeblog14:01:12

Another question related to github pages (default settings). Clerk stores images in _data folder, looks like it's not propagated to the pages, anyone knows how to fix that?

genmeblog14:01:54

oh! cool checking.

genmeblog14:01:42

works! thanks!

🙌 4
Varghiz clj20:01:30

Hi, I'm looking for component/solution where I can transform malli schema to clerk to document the schema/spec in html format... This is just a start but ultimate need is to convert it to something I can publish in confluent wiki

borkdude22:01:56

@sritchie09 https://twitter.com/borkdude/status/1618738758819655680 I know you're not on the bird site anymore, but here you go. Perhaps the answer is emmy + clerk?

❤️ 4
Sam Ritchie22:01:40

Yeah I think so!! @dustingetz that’s exactly what I’ve been building all these pieces for. For 2d check out http://Jsxgraph.Mentat.org http://Mafs.Mentat.org Those plus functions in Emmy is a pretty powerful combo https://github.com/mentat-collective/emmy

👀 2
Dustin Getz03:01:23

this looks great

Dustin Getz03:01:31

https://nextjournal.com/try/samritchie/emmy this link is dead, do you have the working link

Dustin Getz03:01:56

you guys have done a lot of work on this!

Sam Ritchie05:01:19

@dustingetz some fallout from my find and replace…

Sam Ritchie05:01:06

@dustingetz another piece of the puzzle is http://mathlive.Mentat.orghttp://mathlive.Mentat.orghttp://mathlive.Mentat.org … that will parse into Emmy code so you can enter or edit your clj functions in an equation editor . Lots of work, should make for a nice experience once it’s all sewn together!

Dustin Getz16:01:53

I'm having trouble quickly grasping what the vision is, what the elements are, how they connect and what exactly works today. Could you make like a gist that lists these?

Sam Ritchie16:01:47

Sure: • Emmy: computer algebra system based on the idea of extensible, generic mathematical functions (basically multimethod-based), and a ton of different mathematical data types that implement the multimethods and all work together. ◦ then a bunch of code built on that like automatic differentiation, numerical integration, ODE solvers, symbolic equation simplifiers, ◦ function compilers that take advantage of the multimethod flexibility to compile code => js, => JVM, to WebGL, etc ◦ different renderers for all of the types, so I can print equations as TeX etc ◦ classical mechanics package built on top of all of this ◦ differential geometry ◦ special and general relativity code ◦ this all powers two large, advanced physics textbooks… then all of the other libraries exist for me to plug in “viewers” for these mathematical data types

Sam Ritchie16:01:49

and all of those are available as their own, nothing-to-do-with-emmy packages, where the pages linked above should be pretty self-explanatory? way beyond self-explanatory if I did my job right with the docs

Sam Ritchie16:01:55

and then clerk coordinates all of this and turns it into open-source Mathematica

Sam Ritchie16:01:52

@dustingetz lmk if that clears up the vision… If you want a more text-y vision, I’m still mostly trying to get this idea working: https://roadtoreality.substack.com/p/the-dynamic-notebook

Dustin Getz20:01:05

I tried to clean it into a coherent statement of what you have, this is as far as i got in the time i had if it's helpful - https://gist.github.com/dustingetz/e2b734627e275d32204c5a8e7c62249d

Sam Ritchie21:01:12

Nice! And I hear the suggestion that I post this :)

Sam Ritchie21:01:44

@dustingetz so what do you think? are you down to give this toolkit a try for your mathematical explorations?

Sam Ritchie21:01:40

@dustingetz it was really just this past week that I think I’ve cracked the code on how to make all of this stuff really easy to use together. the algebra system by itself is very solid for “real work”… but it’s very weird for anyone not in the Clojure world. the algebra system PLUS these visualizers becomes something more powerful than anything else out there, imo

Dustin Getz21:01:23

i'd like to try it rather than learn mathematica or sagemath which is janky AF, im not quite sure where to start

Sam Ritchie21:01:49

@dustingetz I’m happy to help! I would say the thing to start with is a Clerk project with Emmy as a dependency, as well as whichever of these viewer libraries you want to try

Sam Ritchie21:01:20

making this easy is my project this week, incidentally. but the clerk/custom template here is a good first step: https://github.com/nextjournal/clerk-cljs-demo

👀 2
Sam Ritchie21:01:13

and then here is an example of a clerk notebook that goes to town with some generic math code: https://github.com/nextjournal/clerk-demo/blob/main/notebooks/sicmutils.clj

Sam Ritchie21:01:22

change “sicmutils” to “emmy” 🙂

Dustin Getz21:01:53

do you have a clerk link i can fork

Dustin Getz21:01:57

it's a clj lib not cljs, right?

Sam Ritchie21:01:29

@dustingetz if you tell me what you want to do, I can get you a hello world repo set up, sure

Dustin Getz21:01:44

ah clerk isn't nextjournal i forgot

Sam Ritchie21:01:18

@dustingetz but if you run the command for that template you’ll get something really good

Sam Ritchie21:01:22

want to give that a try?

Dustin Getz21:01:07

so the best way to get started is to clone this https://github.com/nextjournal/clerk-demo/ and use the sicmutils demo?

Sam Ritchie21:01:56

that would do it, but if you want to play with the new visualization stuff I’d recommend following the directions at https://github.com/nextjournal/clerk-cljs-demo and making a new project with the clerk/custom template

Sam Ritchie21:01:34

early this week I can get some more Batteries Included for you, and make an Emmy specific project template

Dustin Getz21:01:03

what is the difference between emmy and scimutil?

Sam Ritchie21:01:09

but lmk what you want to play with, like “I really want some math graphs that animate”, or “I want to figure out what the heck an ODE is”, and I can help tune

Dustin Getz21:01:35

i'm following youtube playlists on complex analysis and linear algebra intro

Sam Ritchie21:01:10

@dustingetz “sicmutils” was the original name for the project, but now 2 years into coding, I’ve ported basically the entire algebra system from Sussman’s original work, and with these visualizers etc it’s much more general than “utilities for Structure and Interpretation of Classical Mechanics” (SICM)”

Dustin Getz21:01:39

ok so emmy is the rebrand

Sam Ritchie21:01:41

so I forked my own project, and once I get Emmy released I’ll make sicmutils into a single namespace, sicmutils.env, that depends on emmy, basically gutting it

Dustin Getz21:01:07

sicmutils is a clojure port of a system built by Sussman?

Sam Ritchie21:01:22

@dustingetz but yes, Sussman has a system called “scmutils” that he started in the late 80s that backs his two physics textbooks. it’s a huge MIT scheme library, 60k lines or so that pioneered a bunch of stuff like autodiff

Sam Ritchie22:01:09

@dustingetz I mean the EASIEST way to get started is to get the dependency and then run (require '[emmy.env :use :all])

Sam Ritchie22:01:24

I still don’t have all of this sewn together into an ultra-easy-to-use package, clearly. that’s the next project, getting Emmy sewn in with these math visualization libraries

Dustin Getz22:01:37

what is lost by a naked deps.edn setup with (require '[emmy.env :use :all]) ?

Dustin Getz22:01:44

web rendering?

Sam Ritchie22:01:06

Basically TeX rendering

Sam Ritchie22:01:11

Not sure if you’ve used Clerk yet but Clerk actually just watches an existing namespace, so you don’t do anything different to use clerk

Sam Ritchie22:01:40

Just start it and then it can render the TeX etc in its web view

Dustin Getz22:01:03

I got this error following the clerk cljs demo steps:

Execution error (ExceptionInfo) at org.corfield.new/create (new.clj:74).
notebooks already exists (and :overwrite was not true).
it's a fresh clone

Dustin Getz22:01:42

i blindly pasted this, is the hardcoded sha intended?

clojure -Sdeps '{:deps {io.github.nextjournal/clerk-cljs-demo {:git/sha "b805370715fdcaf34f6a9d6cb2efc2b12153c90c"}}}' \
  -Tnew create \
    :template clerk/custom \
    :name myusername/notebooks

Sam Ritchie22:01:50

Sounds like the folder “notebooks” already exists

Sam Ritchie22:01:12

But yeah change to the latest SHA also!

Dustin Getz22:01:19

ah, it does indeed exist but i didnt put it there

Sam Ritchie22:01:22

And pick a new name so it goes in a different folder

Sam Ritchie22:01:29

Or delete the existing notebooks folder

Dustin Getz22:01:26

ok, i have the template

Dustin Getz22:01:29

how do i run it?

Sam Ritchie22:01:06

Look at the generated readme

Sam Ritchie22:01:16

I think i added notes there

Dustin Getz22:01:17

notebooks % bb start-clerk
Downloading pod clj-kondo/clj-kondo (2023.01.20)
Successfully installed pod clj-kondo/clj-kondo (2023.01.20)
----- Error --------------------------------------------------------------------
Type:     java.lang.Exception
Message:  File does not exist: start-clerk

Dustin Getz22:01:52

bb clerk-watch right?

👍 2
Dustin Getz22:01:16

(I'm seeing a lot of this for the first time sorry, i am old school clojure i guess)

Sam Ritchie22:01:39

Haha me too, just trying to get something easy to use together for newer folks

Sam Ritchie22:01:45

As you can see this isn’t done yet

Dustin Getz22:01:16

i'm tracking the install steps in the gist btw

Sam Ritchie22:01:36

This doesn’t have any of the stuff you want in here yet, just the infrastructure to add it

Sam Ritchie22:01:50

I’m spending tomorrow on this, by the end of the week it should be solid

Dustin Getz22:01:27

ok i have clerk up is there a hello world i can try

Dustin Getz22:01:33

to render some math or something

Dustin Getz22:01:10

ah the sicmutils demo

Dustin Getz23:01:29

boom math !!!

Sam Ritchie23:01:28

Hey, amazing!

Sam Ritchie23:01:33

I wrote a lot of the library as literate essays that I’ll publish with clerk - that is part of the goal, for the library to BE a textbook

Sam Ritchie23:01:51

But if you look through the source of types you’re interested in you’ll find a ton of exposition

Dustin Getz23:01:11

Alright, here is the final doc that gets through hello math world - https://gist.github.com/dustingetz/e2b734627e275d32204c5a8e7c62249d

Dustin Getz23:01:56

do you have a channel for emmy?

Sam Ritchie23:01:38

Currently using #C01ECA9AA74 or #C041G9B1AAK , I’ll convert #C01ECA9AA74 once I finish the port

Sam Ritchie22:01:33

The improvements I have planned will let you, for example, pass a function written in generics, full of derivatives etc but have the graphing component compile the function to JS on mount so the graph runs smoking fast

👀 2
Sam Ritchie22:01:37

@dustingetz but I’m here for this, so if you do go down this path please lean on me, or better yet let’s write some math together

Carsten Behring23:01:38

I went further with my Clerk integration into cider-inspector Here are three EmacsLisp functions for Cider which can be used as followed: https://gist.github.com/behrica/7bacf8a59021336f17027009a46eff9c#file-cider-inspector-tap-with-clerk-viewer-clj 1. clerk-open-tap-inspector to open Clerk tap-inspector 2. clerk-set-current-viewers to set the current viewer names of Clerk into a Emacs variable 3. When in cider-inspector you can now call cider-inspector-tap-current-val-with-clerk-viewer to first interactively select a "Clerk viewer" (by :name) and it will then send the current value to the tap inspector in browser rendered with the selected viewer This is super convenient to use Clerk as a REPL companion, special when the functions above gets key mappings. The drill down of cider-inspector and Clerk's rich rendering capabilities play very well together.

👀 8
👍 4
otfrom08:01:30

where can I learn more about the viewer names (seems I need that to hook everything together)

Carsten Behring17:01:27

On this Clerk is not very clear yet. Some viewers have a :name, some not. A kind of list is here: https://github.com/nextjournal/clerk/blob/main/src/nextjournal/clerk/viewer.cljc Maybe @U5H74UNSF can bring a bit of light in this.

👍 2