I really would like to spend my time on getting zeta
off the ground once this is sorted out.
Because there โ and I really need to push up what I have on disk โ the core API is based on combinators which are backed by objects, with protocols, etc.
There are protocols for both interpretation and compilation.
OT bb
makes me think of Death Stranding every time I type it. ๐
fyi - the docs on the latest build have failed: https://cljdoc.org/d/meander/epsilon/0.0.533
@noprompt This is awesome! How you can best compare bb to JVM Clojure is usage in short-lived scripts that you invoke from the command line. E.g.
$ cat /tmp/meander.clj
(time (require '[meander.interpreter.epsilon :as m]))
(def s1 (m/searcher '(m/re #"f(.)(.)" [_ ?x ?x]) #(get % '?x)))
(time (prn (s1 "foo")))
$ time bb -cp src -f /tmp/meander.clj
"Elapsed time: 113.051096 msecs"
("o")
"Elapsed time: 1.556163 msecs"
bb -cp src -f /tmp/meander.clj 0.10s user 0.04s system 95% cpu 0.145 total
vs
$ time clojure -M /tmp/meander.clj
"Elapsed time: 726.401638 msecs"
("o")
"Elapsed time: 5.592018 msecs"
clojure -M /tmp/meander.clj 3.57s user 0.20s system 221% cpu 1.697 total
Babashka doesn't have the JIT of the JVM and also loops are much more costly in babashka. So for dotimes 10000 examples the JVM will always be much faster. But the above use case is really where bb shines.
There's probably a thing or two that can be optimized in babashka itself. I welcome ideas and contributions :)
@borkdude Thanks for clearing that up!
I hope to do many optimizations in years to come. It's nice to have a side project where you can probably spend years on improving it ;)
Totally. Itโs also nice to have a great community of folks supplying you with a steady stream of praise and critique. ๐
This benefits everyone.
What was cool here is that this sort of forced me to take a look at something โ babashka โ which I have wanted to test out but hadnโt made the time yet.
Someone cough @snoe cough should flag an annoyance that forces my hand into the LSP space. ๐
Now that I have bb
installed I can whip up some fun command line data slice and dice.
@noprompt Let me know when you release the interpreter bits. I'll make a mention at - https://github.com/borkdude/babashka/blob/master/doc/news.md - https://github.com/borkdude/babashka/blob/master/doc/libraries.md
@borkdude I would probably like hacking on babashka but I have this project, Asami at work that Iโm helping with, and other work/family responsibilities.
Maybe next year Iโll have some time.
The situation with Covid really hit me hard. My 3 kids are home 90% of the time.
@noprompt The interpreter powering bb is https://github.com/borkdude/sci You can use this to create your own CLIs that have Clojure interpretation. There could be a meander CLI. I've recently made a CLI that uses clojure.spec: https://github.com/borkdude/grasp#binary
echo <some edn> | meander -e "...."
> The situation with Covid really hit me hard. My 3 kids are home 90% of the time. Oof, wish you the best in these hard times!
Yeah, two things Iโve wanted to experiment with but have since put on the back burner are partially evaluated, and small step interpreted Clojure. If I were cool enough, Iโd try gluing the two together.
Somehow I learned about term rewriting during my initial experiments and here I am.
Iโll make a test suite for the interpreter, cut a release, and then we can add a test suite for bb
@borkdude One of the ideas I have โ and maybe we can mutually inspire each other on this one โ is to create an interactive search and replace experience based on rewriting. Iโm imaging something integrated into an editor where you have input area for the search, an optional one for the replacement, and an output area which display the search results and, optionally, their transformation based on the rewrite rule.
You could even imagine this operating at a โmeta syntaxโ level where in the rewrite rules are operating on the AST instead of the form directly, etc.
@noprompt This could be useful for clj-kondo hooks as well maybe. As a higher level DSL. https://github.com/borkdude/clj-kondo/blob/master/doc/hooks.md clj-kondo hooks are functions that do rewriting of rewrite-clj nodes to teach clj-kondo about custom macros
Often what I do with meander when I want to edit code in this way, is copy a form, quote it, and then start hammering on it with m/rewrite
and C-c C-f
in Emacs until I get the desired result. Then I copy, paste, format.
@borkdude I could probably answer this myself but Iโm lazy so, does sci use itโs own reader?