meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
markaddleman 2020-12-11T15:15:06.450800Z

I'm curious what you guys think about enhancing the m/$ operator to avoid subtrees matching a pattern. I have a tree that contains information at one semantic level that I'd like to use to rewrite all the nodes at that same semantic level. It would be convenient to use m/$ to match all the nodes at that level but it traverses into lower levels and, thus, ends up matching too much.

jimmy 2020-12-11T16:42:06.451Z

Could you share a simplified example? (or the real one if you want)

noprompt 2020-12-11T20:24:22.451300Z

An example would be great but, to summarize, are you asking if the operator can do a top down traversal and stop once a match has been made?

markaddleman 2020-12-11T20:45:44.451600Z

Yep. That's exactly what I'm looking for.

markaddleman 2020-12-11T20:46:09.451800Z

I can provide an example of what I'm trying to do this weekend

markaddleman 2020-12-11T20:47:03.452Z

@noprompt I'm not entirely sure we're on the same page. I'd like the operator to do a top traversal matching everything for p1 and stop when it reaches p2

noprompt 2020-12-11T20:50:21.452200Z

(top-down match_p stop_p)

👍 1
noprompt 2020-12-11T20:53:19.452400Z

I need to think about this a bit more because I would like to have this model work in both directions e.g. the dual of this, I think, would be to construct a tree.

markaddleman 2020-12-11T20:54:06.452700Z

that would be pretty cool

noprompt 2020-12-11T20:54:10.452900Z

In the mean time I know we can fill in the blanks with something that does what you’re looking for. There are a few thing ahead in the queue though.

noprompt 2020-12-11T20:54:12.453100Z

Yes.

markaddleman 2020-12-11T20:56:34.453300Z

I'm using meander to parse honeysql and rewrite it. Currently, I'm avoiding generating an AST. But, eventually, I'm going to need to convert between an AST and honeysql. Your dual top-down operator could be very handy for this, I imagine

noprompt 2020-12-11T20:56:37.453500Z

It seems like the dual would be grow a tree with the node pattern until it matches the stop pattern, however, there needs to be a notion of where the children go.

noprompt 2020-12-11T20:58:02.453700Z

This is something that needs thought anyway, it was bound to come up.

noprompt 2020-12-11T20:58:21.453900Z

Are you able to use the strategy combinators in the mean time?

noprompt 2020-12-11T20:58:30.454100Z

There is m*/top-down-while

markaddleman 2020-12-11T20:58:58.454300Z

I haven't touched the strategy stuff yet. That's a this weekend project 🙂

noprompt 2020-12-11T21:00:02.454500Z

Sure. My hope is that, eventually, what is in the main namespace, the interpreter work, and the strategies can all be joined together in a super nova of fun times 😛

markaddleman 2020-12-11T21:00:30.454700Z

😄

noprompt 2020-12-11T21:02:11.454900Z

This is my immortality project. 🙂

markaddleman 2020-12-11T21:03:01.455100Z

I have to say, meander has been a game changer for me. The bulk of my application code is generating SQL statements from fragments of SQL that know how to project various bits of data. SQL is a bear to compose but meander has given me a way of taming it without completely losing my mind.

👍 1
noprompt 2020-12-11T21:08:18.455300Z

That’s really great to hear. If you’re ever open to it — and there is zero pressure when I say this — you could always drop some snippets of what you’re doing the in the cookbook etc.

noprompt 2020-12-11T21:08:35.455500Z

That’s a space for anyone and everyone.

markaddleman 2020-12-11T21:50:01.455700Z

Yep. That's on my to-do list