[HN Gopher] Clerk: Local-First Notebooks for Clojure
       ___________________________________________________________________
        
       Clerk: Local-First Notebooks for Clojure
        
       Author : tosh
       Score  : 101 points
       Date   : 2021-11-04 14:10 UTC (8 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | [deleted]
        
       | pjmlp wrote:
       | Look, a Lisp Machine. :)
       | 
       | Jokes aside, good work.
        
       | jcytong wrote:
       | From the README                 Specifically Clerk wants to
       | address the following problems:            - Less helpful than my
       | editor            - Notebook code being hard to reuse
       | - Reproduction problems coming from out-of-order execution
       | - Problems with archival and putting notebooks in source control
       | 
       | I encounter these problems every time I interact with a Juypter
       | notebook and think about a Clojure style notebook environment :)
       | 
       | Great job!!!
        
       | kvlr wrote:
       | Hey! We're excited to finally open source Clerk. Clerk is a
       | local-first notebook, built on top of regular Clojure namespaces.
       | 
       | It can take a namespace like
       | https://github.com/nextjournal/clerk/blob/fd79f7504ebffaa279...
       | and turn it into https://storage.googleapis.com/nextjournal-
       | snapshots/clerk/b...
       | 
       | The main idea behind Clerk is letting folks use the editors they
       | know & love and not force them to edit code inside a web browser.
       | (This came to us only after working for a few years on
       | nextjournal.com where folks can edit notebooks in a web browser
       | but better late than never :)
       | 
       | In order to keep the feedback loop fast Clerk keeps a dependency
       | graph of all forms and vars in a notebook to figure out what
       | changed between runs on a notebook and only runs those.
       | 
       | There's no homepage for it yet but Clerk is running a handful of
       | sample notebooks on every commit and building a static website
       | out of them. The latest version is at
       | https://storage.googleapis.com/nextjournal-snapshots/clerk/b...
        
         | hencq wrote:
         | > In order to keep the feedback loop fast Clerk keeps a
         | dependency graph of all forms and vars in a notebook to figure
         | out what changed between runs on a notebook and only runs
         | those.
         | 
         | This sounds interesting. Is it essentially an abstraction where
         | to the programmer it seems like the whole notebook runs again
         | for every change? Almost similar to how React makes it seem to
         | the programmer that they are regenerating the entire page?
        
           | jackrusher wrote:
           | That's exactly it, yeah. It looks like a hot reload on save,
           | but it does only the minimum calculation required.
        
       | romero-jk wrote:
       | What do most here use Clojure for? For me, there was little value
       | in using it over nodejs for single server CRUD apps with
       | postgres. Some things I liked are namespace keywords, REPl
       | integrated with your editor, immutability. But still, it felt
       | like swimming against the current. Immutability is not as useful
       | in a single-threaded event-loop like nodejs. No third party SDKs,
       | even though I know Java using the Java SDKs was tedious labor,
       | most Clojure wrappers are pretty bad too, so more interop.
        
         | dgb23 wrote:
         | You can use Clojure on Nodejs too.
         | 
         | I personally can't use it for production code. But whenever I
         | automate something or write some prototype I use Clojure.
         | Iterations are faster, more direct, less of a hassle.
         | 
         | There has also been someone commenting around here that they
         | use it as an network repl to poke around running production
         | systems, which I find an interesting use case.
        
         | carbonguy wrote:
         | I've been a Clojure hobbyist for many years, and these are a
         | few of the things I've done repeatedly:
         | 
         | - Scrape webpages with http-kit and Specter
         | 
         | - Visualizations with Quil
         | 
         | - Serve static pages with Ring, Compojure, and Hiccup
         | 
         | (un)Fortunately, I don't write Clojure professionally, so I can
         | get away with liking it for aesthetic reasons as much as
         | anything. It definitely does feel like swimming against the
         | current sometimes, though - one runs into bus factor issues a
         | lot in the Clojure ecosystem. But hell, I love it all the same
         | :)
         | 
         | Personally, I am really excited for Clerk - this looks like a
         | really useful tool and I'm looking forward to trying it out!
        
           | bmitc wrote:
           | Got any links to stuff you've done with Quil?
        
         | ReleaseCandidat wrote:
         | > What do most here use Clojure for?
         | 
         | That's to evade having to use Java, Scala or Kotlin.
         | 
         | Clojurescript: because it's the easiest (compared to Elm,
         | Purescript and Rescript) to call JS.
        
         | knubie wrote:
         | > Immutability is not as useful in a single-threaded event-loop
         | like nodejs.
         | 
         | Concurrency is not the only, or even primary, benefit of
         | immutability in software. State and state management is the
         | number one driver of complexity in software, and complexity
         | itself is the number one problem that makes building software
         | hard. [0]
         | 
         | > For me, there was little value in using it over nodejs for
         | single server CRUD apps with postgres.
         | 
         | You can use clojure on nodejs with the value that clojure is a
         | much, _much_ better language than javascript.
         | 
         | [0] http://curtclifton.net/papers/MoseleyMarks06a.pdf
        
           | romero-jk wrote:
           | I was referring to Clojure's immutable data structures, not
           | immutability in general. My nodejs apps are just
           | transformations pipelines of pure functions with postgres
           | being my global mutable state. Clojure doesn't offer me
           | anything here that I can't easily do with JS/node.
           | 
           | Sure Clojure is a better language but not better enough
           | justify the additional abstraction layer IMO.
        
       | mmcdermott wrote:
       | How crazy would it be to take something like this, compile it
       | with ClojureScript and embed it in something like TiddlyWiki? I
       | could see something like that being a nice way to hyperlink the
       | more static documentation to the calculated results.
        
       | hatmatrix wrote:
       | Sorry for the tangential question - does Clojure play nice with
       | org-babel? Can this notebook interface be used with org-babel?
        
         | nanomonkey wrote:
         | Babashka works exceedingly well with org-babel, much nicer than
         | using Clojure directly as you don't have to worry about setting
         | up a project, namespace and connecting with cider.
         | 
         | See the following gist: https://gist.github.com/adam-
         | james-v/f4d2b75a70b095d14a351a1...
         | 
         | And example code: https://github.com/adam-james-v/bb-
         | draw/blob/main/bb-draw.or...
        
         | sleepycatgirl wrote:
         | Clojure certainly works with org-babel, though in my
         | experience, there must be done one thing - You have to start
         | Clojure repl, and then jack in with cider, and only then you
         | can evaluate code blocks.
         | 
         | Here is a bit more info regarding it itself.
         | https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-...
        
       ___________________________________________________________________
       (page generated 2021-11-04 23:01 UTC)