meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
noprompt 2020-11-20T00:02:04.359400Z

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

noprompt 2020-11-20T00:03:32.360700Z

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.

noprompt 2020-11-20T00:04:13.361300Z

There are protocols for both interpretation and compilation.

noprompt 2020-11-20T00:05:32.361900Z

OT bb makes me think of Death Stranding every time I type it. ๐Ÿ™‚

markaddleman 2020-11-20T03:30:32.362200Z

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

๐Ÿ‘ 1
borkdude 2020-11-20T08:45:55.363300Z

@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

borkdude 2020-11-20T08:47:35.364600Z

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.

๐Ÿ‘ 1
borkdude 2020-11-20T09:39:22.365100Z

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

noprompt 2020-11-20T17:12:21.366100Z

@borkdude Thanks for clearing that up!

borkdude 2020-11-20T17:13:33.367300Z

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

noprompt 2020-11-20T17:14:57.368500Z

Totally. Itโ€™s also nice to have a great community of folks supplying you with a steady stream of praise and critique. ๐Ÿ™‚

noprompt 2020-11-20T17:15:09.368700Z

This benefits everyone.

noprompt 2020-11-20T17:16:39.370400Z

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.

noprompt 2020-11-20T17:17:39.371400Z

Someone cough @snoe cough should flag an annoyance that forces my hand into the LSP space. ๐Ÿ˜›

noprompt 2020-11-20T17:18:35.372200Z

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

borkdude 2020-11-20T17:20:39.373400Z

@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

noprompt 2020-11-20T17:21:14.374200Z

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

noprompt 2020-11-20T17:21:35.374600Z

Maybe next year Iโ€™ll have some time.

noprompt 2020-11-20T17:22:06.375600Z

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

borkdude 2020-11-20T17:22:43.376600Z

@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

borkdude 2020-11-20T17:24:01.377600Z

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

borkdude 2020-11-20T17:27:25.378Z

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

noprompt 2020-11-20T17:29:32.379400Z

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.

noprompt 2020-11-20T17:30:28.380200Z

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

noprompt 2020-11-20T17:32:42.381800Z

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

๐ŸŽ‰ 1
noprompt 2020-11-20T17:38:59.385800Z

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

noprompt 2020-11-20T17:39:55.386800Z

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.

borkdude 2020-11-20T17:40:57.387800Z

@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

๐Ÿ‘ 1
noprompt 2020-11-20T17:41:31.388800Z

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.

noprompt 2020-11-20T17:49:13.389700Z

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

borkdude 2020-11-20T17:51:10.390200Z

@noprompt it uses https://github.com/borkdude/edamame

๐Ÿ‘ 1