Fork me on GitHub
#meander
<
2020-11-20
>
noprompt00:11:04

I really would like to spend my time on getting zeta off the ground once this is sorted out.

noprompt00:11:32

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.

noprompt00:11:13

There are protocols for both interpretation and compilation.

noprompt00:11:32

OT bb makes me think of Death Stranding every time I type it. 🙂

markaddleman03:11:32

fyi - the docs on the latest build have failed: https://cljdoc.org/d/meander/epsilon/0.0.533

👍 3
borkdude08:11:55

@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

borkdude08:11:35

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.

👍 3
borkdude09:11:22

There's probably a thing or two that can be optimized in babashka itself. I welcome ideas and contributions :)

noprompt17:11:21

@borkdude Thanks for clearing that up!

borkdude17:11:33

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 ;)

noprompt17:11:57

Totally. It’s also nice to have a great community of folks supplying you with a steady stream of praise and critique. 🙂

noprompt17:11:09

This benefits everyone.

noprompt17:11:39

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.

noprompt17:11:39

Someone cough @snoe cough should flag an annoyance that forces my hand into the LSP space. 😛

noprompt17:11:35

Now that I have bb installed I can whip up some fun command line data slice and dice.

noprompt17:11:14

@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.

noprompt17:11:35

Maybe next year I’ll have some time.

noprompt17:11:06

The situation with Covid really hit me hard. My 3 kids are home 90% of the time.

borkdude17:11:43

@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

borkdude17:11:01

echo <some edn> | meander -e "...."

borkdude17:11:25

> 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!

noprompt17:11:32

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.

noprompt17:11:28

Somehow I learned about term rewriting during my initial experiments and here I am.

noprompt17:11:42

I’ll make a test suite for the interpreter, cut a release, and then we can add a test suite for bb

🎉 3
noprompt17:11:59

@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.

noprompt17:11:55

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.

borkdude17:11:57

@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

👍 3
noprompt17:11:31

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.

noprompt17:11:13

@borkdude I could probably answer this myself but I’m lazy so, does sci use it’s own reader?