meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
dgr 2020-12-16T00:50:04.016100Z

@noprompt My pleasure.

dgr 2020-12-16T01:10:15.016800Z

@noprompt, OK, I filed the issue about nil vs. (). I don’t seem to have a way to tag the issue with anything, so I think you’ll have to do that.

noprompt 2020-12-16T01:46:19.017Z

Got it

noprompt 2020-12-16T21:45:55.018500Z

I merged the interpreter work. It’s light on the docs and on the tests. There are some things about CLJS that need to mentioning but it’s working and we can tweak that later.

noprompt 2020-12-16T21:46:13.018900Z

Again, I would call this experimental.

noprompt 2020-12-16T21:46:59.019800Z

There’s some sci symbol resolution that needs to be fixed to have this work in babashka but it works well enough.

noprompt 2020-12-16T21:47:11.020Z

Well, once that problem is fixed.

noprompt 2020-12-16T21:48:08.020800Z

@droberts3 I’m going to merge your doc patch. It’s outstanding. Thank you for that.

👍 1
borkdude 2020-12-16T21:48:37.021400Z

@noprompt I'm currently refactoring some code in sci where I'm also hitting that code. So maybe I'll just fix it if you don't mind

noprompt 2020-12-16T21:49:28.022400Z

@borkdude Ah, that would be great. Actually, I was planning on trying to make it a bit more declarative and surprise you but that might take longer than you just getting it done. 🙂

noprompt 2020-12-16T21:51:22.024100Z

I’m looking forward to that because I think with bb and the direction the code is now going in, there’s going to be an opportunity to make some fun data shredding/querying stuff on the CLI.

borkdude 2020-12-16T21:53:03.024900Z

bb also got a new feature last weekend to add deps directly in a script: https://book.babashka.org/#_add_deps so it will be very easy to try out meander with bb

noprompt 2020-12-16T21:54:47.026900Z

@droberts3 I’ve extended an opportunity for you to work on branches connected to the main project, etc. Take advantage of it if it reduces friction in the contribution process for you. All that I ask is that you continue to open PRs and have them reviewed before pressing the merge button. 🙂

noprompt 2020-12-16T21:55:22.027400Z

Kick ass!

noprompt 2020-12-16T21:56:09.028300Z

Yeah, that’s really sweet.

dgr 2020-12-16T21:56:15.028500Z

@noprompt, OK. I’ll just continue to submit PRs unless I find a strong reason otherwise.

noprompt 2020-12-16T21:56:52.029200Z

Heh, we’re gonna need to figure out how to make one of these cool new markdown books that seem to be en vogue these days.

noprompt 2020-12-16T21:57:30.030Z

The docs look pretty nice on clj-doc I gotta say.

dgr 2020-12-16T21:57:32.030100Z

I was actually going to suggest perhaps looking at adoc. It’s also supported by github and CIDER is using it.

dgr 2020-12-16T21:57:48.030600Z

I don’t know if clj-doc supports it.

dgr 2020-12-16T21:58:11.031200Z

It has some nicer support for doing examples

noprompt 2020-12-16T21:58:59.032Z

IIRC adoc came up previously. If clj-doc supports it and that is a better format then I’d be open to checking that out.

noprompt 2020-12-16T21:59:22.032600Z

If not, I’d prefer we stick to what they support for now pending a script or something to roll into the build process.

dgr 2020-12-16T22:00:05.034Z

Yep. I can take a look and we could trial a conversion of one of the docs to see how it looks. We could also convert incrementally.

noprompt 2020-12-16T22:00:06.034200Z

There is a bin/build-release script and we can wire in that compilation to markdown if need be.

dgr 2020-12-16T22:00:17.034600Z

Ultimately adoc is a lot more powerful than Markdown.

noprompt 2020-12-16T22:00:19.034800Z

Alrighty, yeah, have at it. 🙂

noprompt 2020-12-16T22:00:54.035400Z

I suck at docs so this an area where I can use all the help I can get.

noprompt 2020-12-16T22:01:52.036400Z

With the big asterisks “no pressure, family first, etc.” attached.

dgr 2020-12-16T22:03:50.038300Z

Cool. I’ll focus on content for now. I think the priority should be on the matching macros, patterns, and then substitutions. Once we have those well-documented, that will be huge.

dgr 2020-12-16T22:04:47.039800Z

I also want to pull over some of the ideas in some of @jimmy’s blogs. I was reading through those a couple days ago and there’s some really great content there. The Meander in Meander post was very thought-provoking.

🙂 1
noprompt 2020-12-16T22:05:52.041200Z

Awesome. I’ll continue to loop folks here in on what is coming down the line. The most significant changes are going to come with local and project and dissolving the differences between the left and right sides such that any pattern can be used on either side.

noprompt 2020-12-16T22:06:21.041500Z

I enjoyed that post too.

noprompt 2020-12-16T22:08:17.043300Z

We’ll definitely be applying some of those techniques in zeta however. With the functional API established, we can use that internally for all sorts of things like parsing and compiling.

noprompt 2020-12-16T22:09:25.044Z

I really wanted to write zeta with epsilon but, yeah, it’s just not there yet, however, it does get really close.

noprompt 2020-12-16T22:10:16.044600Z

Another thing is, I would like the ground floor to be inclusive of folks existing Clojure chops.

dgr 2020-12-16T22:10:44.045200Z

Yea, certainly.

dgr 2020-12-16T22:11:04.046Z

We want to educate folks, not scare the crap out of them with the advanced class right out of the gate.

noprompt 2020-12-16T22:11:11.046200Z

Starting at Meander and working up might having a chilling effect on folks looking to contribute.

noprompt 2020-12-16T22:11:23.046500Z

Hahaha, yes. 🙂

dgr 2020-12-16T22:12:12.047200Z

But I think nothing would show the power of Meander than writing Meander in Meander. Not to mention the meta-recursion points you’d earn. 🙂

noprompt 2020-12-16T22:13:09.047400Z

Here’s the parser: https://github.com/noprompt/meander/blob/zeta/dev/meander/dev/parse/zeta.clj#L59

noprompt 2020-12-16T22:13:33.047700Z

And the match compiler: https://github.com/noprompt/meander/blob/zeta/dev/meander/dev/match/zeta.clj#L18

noprompt 2020-12-16T22:14:05.048100Z

And operating those things: https://github.com/noprompt/meander/blob/zeta/dev/meander/dev/zeta.clj

noprompt 2020-12-16T22:15:05.049500Z

This is informative stuff, it works, and it performs decently, but there are some developer creature comforts missing.

noprompt 2020-12-16T22:16:11.050400Z

In previous discussions with @e749 a big issue with large systems like this is that you don’t have a good way of diagnosing what is happening.

noprompt 2020-12-16T22:17:36.051800Z

However, this problem should mostly be solved now by the approach taken by factory code: building up a pattern factory and using dependency injection to pass in how it should operate at runtime.

noprompt 2020-12-16T22:18:33.053700Z

You can pass a runtime that prints or collects information about rewriting/matching/etc.

dgr 2020-12-16T22:19:03.054400Z

Yea, deep macrology is always awesome. Right until it blows up. And then you’re wading through 10,000 lines of macroexpansion and wondering how expensive it is just to write it all from scratch.

noprompt 2020-12-16T22:19:52.055200Z

True.

noprompt 2020-12-16T22:21:02.056600Z

My hope though is that with explainability, composability, interpretability, compilability, and being able to mix and match those things both at runtime and compile time it’ll solve those problems.

noprompt 2020-12-16T22:21:34.057100Z

The goal is to have something like spec style explainability and conform without the terrible performance.

dgr 2020-12-16T22:21:58.057800Z

Makes sense.

noprompt 2020-12-16T22:22:24.058400Z

But also, I don’t want to necessarily need to use clojure.test.check either and have my specs and code be separted.

noprompt 2020-12-16T22:22:58.059Z

I should be able to define a pattern and use it aggressively at every level.

noprompt 2020-12-16T22:23:19.059200Z

Now I’m just rambling.

noprompt 2020-12-16T22:23:24.059400Z

I probably need to eat. 🙂

dgr 2020-12-16T22:23:29.059600Z

LOL

noprompt 2020-12-16T22:24:36.060800Z

So, soon you’ll be able to say (yield <pattern> [bindings]) and have it spit out a stream of all the ways to construct pattern from those bindings.

dgr 2020-12-16T22:25:11.061400Z

Interesting. That would be cool.

noprompt 2020-12-16T22:25:31.062100Z

I think 3 to 6 weeks from now depending on how much hacking I do during the upcoming winter break.

dgr 2020-12-16T22:26:06.063Z

Meander is a weird love child of a term rewriting system, a logic programming language, and Lisp.

noprompt 2020-12-16T22:26:18.063200Z

It is easy to find excuses to play games when you have a Geforce 3080 😛

noprompt 2020-12-16T22:26:30.063400Z

Yes!

noprompt 2020-12-16T22:29:22.066500Z

And that’s kind of where I want it. Term rewriting is awesome but many devs will start dropping packets the moment you start talking to them about it. Logic programming is also great but its hard to ignore that devs also have to invest a lot of their own time to learn new tricks, something that’s not always appealing without and obvious pot of gold on the other end. Lisp is close enough to “normal” programming that you can sneak devs in with stuff they know.

noprompt 2020-12-16T22:29:49.067200Z

One thing we all understand is data literals.

borkdude 2020-12-16T22:30:24.068400Z

just pushed the fix to sci and bb

dgr 2020-12-16T22:30:32.068800Z

Yes, agreed. See, I love all those “old” technologies. Everybody else has basically forgotten about them, but there are a ton of really, really useful ideas lurking in those old CS papers.

noprompt 2020-12-16T22:30:35.068900Z

So how can we leverage the things that are easy to grok for everyone?

noprompt 2020-12-16T22:30:47.069100Z

Yes, yes.

noprompt 2020-12-16T22:31:04.069300Z

You’re the bomb @borkdude 🙂

noprompt 2020-12-16T22:32:24.071500Z

Logic variables and data literals are easy to understand. Pattern matching is also pretty easy for people to pick up because it is often a subtle tweak on what they already know about those two things.

dgr 2020-12-16T22:32:31.071700Z

One reason I like Meander, I think, is that it doesn’t try to be more than it needs to be. For instance, I would probably hate to write a large program in nothing by Prolog. But I’d love a great logic engine embedded in Clojure that you can call out too (unfortunately, core.logic has too many limitations and seems almost abandoned at this point).

noprompt 2020-12-16T22:32:53.072100Z

It’s funny you mention that.

dgr 2020-12-16T22:32:59.072500Z

Ditto with a term rewriting system.

dgr 2020-12-16T22:33:53.074400Z

I want to be “in Clojure” and be able to say, “Here’s a logic problem that I need solved. Solve it.” Or “Here’s a data structure I need rewritten. Rewrite it.”

dgr 2020-12-16T22:34:18.075400Z

Then, take the answer and slam it into Hiccup or whatever.

noprompt 2020-12-16T22:34:21.075500Z

Maps alone, which arguably are the bread and butter structure of most Clojure programs, are just flat out annoying to work with in stock core logic. And that’s not say something bad about core logic; it’s just the case.

dgr 2020-12-16T22:34:33.075800Z

Yep.

noprompt 2020-12-16T22:34:40.076200Z

Right. Stuff can be very blunt and very forward.

noprompt 2020-12-16T22:35:41.077900Z

Which, arguably, you can see in Prolog and even Haskell or ML style language in the pattern matching oriented parts fo the language.

dgr 2020-12-16T22:35:42.078Z

Well, and core.logic doesn’t have some good things that Prolog has (notably missing are things like findall, bagof and setof.

dgr 2020-12-16T22:37:13.080100Z

I think Mark Engelberg did a great job with his Rolling Stones library, wrapping sat4j up. I’ve used that as a nice way to incorporate a SAT solver.

noprompt 2020-12-16T22:37:31.080300Z

I should check that out.

dgr 2020-12-16T22:38:21.081900Z

Yea, it’s nice. It’s all data driven, so, you could actually describe your problem in another data format and then use Meander to (help?) construct the SAT problem.

noprompt 2020-12-16T22:38:57.082800Z

Ah, man, that sounds cool.

dgr 2020-12-16T22:38:57.082900Z

Then throw the SAT problem at Rolling Stones, which then translates it into Java objects for sat4j.

noprompt 2020-12-16T22:39:09.083200Z

Interesting. Putting that on the todo list.

dgr 2020-12-16T22:39:38.083600Z

Dude, you have a GeForce 3080. Where are you going to find the time? 😛

noprompt 2020-12-16T22:40:45.084700Z

Hahaha yeah.

noprompt 2020-12-16T22:40:56.085100Z

But I’m paranoid all the time now.

noprompt 2020-12-16T22:41:16.086Z

I’m afraid somehow water is going to magically get poured on top of my case and ruin it.

noprompt 2020-12-16T22:41:43.086900Z

And mostly because everything next-gen is sold out everywhere.

noprompt 2020-12-16T22:41:53.087100Z

2020 in spades.

dgr 2020-12-16T22:42:19.087500Z

Yea, well, 2020 just needs to die right now. Here’s to 2021.

noprompt 2020-12-16T22:42:28.087800Z

Cheers to that.

dgr 2020-12-16T22:42:42.088200Z

Seriously, things like TRS, Logic Programming, SAT, etc. are power tools. And today’s coders are worried about the latest Javascript framework. :face_with_rolling_eyes:

👍 1
noprompt 2020-12-16T22:43:28.088900Z

Yes. We need to have LP catch on the way FP has in recent times.

noprompt 2020-12-16T22:44:45.090200Z

I’ve been thinking that I would be neat to take the direction Meander is going in, emphasizing the forward concepts with an LP slant, mix in some data flow and call it a prototype language.

noprompt 2020-12-16T22:45:31.090700Z

But, in general, it would be nice to see more of LP catching on. I think it will.

dgr 2020-12-16T22:47:52.091800Z

Yea, agreed. One of the hardest parts is to (re)train yourself to think in those ways, however. Honestly, it’s like coming from imperative OOP to functional, but worse.