Hello! I’m trying to rewrite an infix pattern into prefix, like:
'[1 2 3 4 ! 5 6 7] => '[1 2 3 (! 4 5) 6 7]
I’m using rewrite but I can’t figure out the rule. Have I missed a doc page?@ggaillard Here are a couple approaches.
;; Before 0.0.626
(let [xs [1 2 3 4 '! 5 6 7 9]]
(m/rewrite xs
[!head ... ?x '! ?y . !tail ...]
[!head ... ('! ?x ?y) . !tail ...]))
;; =>
[1 2 3 (! 4 5) 6 7 9]
;; 0.0.626 and later
(let [xs [1 2 3 4 '! 5 6 7 9]]
(m/rewrite xs
[& ?head ?x '! ?y & ?tail]
[& ?head ('! ?x ?y) & ?tail]))
;; =>
[1 2 3 (! 4 5) 6 7 9]
Cool! I'll try this. Thank you very much!
0.0.626 has some bugs and I would recommend using 0.0.602
really nice improvement between the two versions! 😄
does Meander have a changelog somewhere?
It does not. It should. There are only so many things I can keep up with. 😛
Does anyone know of a strategy for automatically computing a changelog?
One thing we could do is make that a part of the release building process.
Perhaps we could look at the commit history between the last tagged release, parse it, and make a changelog?
It wouldn’t be perfect but it would at least be something!
Aaaaaand I would totally merge a patch for that! 😉
IMHO changelog is not needed. Meander can safely be considered a niche of clojure niche library.
The few people who use it are certainly smart enough to be able to figure out the changes from the commit history 🙃
LOL
“niche of niche” 😛
Jimmy recently cast it as “avant-garde” which I thought was both high-praise and certain doom. 🙂
But here, there's no fooling around, and you can be happy about it. It's our, or at least mine, secret super weapon and super toy.
You don't have many followers in the meandering church, but anyone who uses a meander will certainly appreciate it.
Thats enough for me! 🙂
I mean, FWIW, the term rewriting space is, well, pretty sparse.
In terms of population and people who “get it”.
If you wanted to be the idol of the crowds, you should have written terminal spinners in javascript, or something equally groundbreaking.
One day.
I’ve been thinking that its probably time for me to just make an actual language out of this thing.
Primarily, I want to build something that is only focused on manipulating data between two pipes.
regarding term rerwriting, I suspect I don't get it but I use it anyway. 🙃
meander is already like a programming language, and writing macros that use meander to write code for meander is an inception that bends the mind.
Anyone thats applied an identity in algebra/trigonometry etc understands term rewriting.
LOL
It is a language, true. But its in Clojure alongside hundreds of other languages.
Of the things I've noticed that sell meander well is the size of the buildsize for CLJS
I’d like to be in the same space as, say, like jq or comby.
Is it good?
yes
Ah, thats great.
I know for a while we had some trouble with that.
meander adds almost nothing of its own, it is after all a macro
And on top of that it tries to generate the best code it can considering its shoot-from-the-hip design. 😛
for more difficult things, I'm almost sure that the resulting code will be smaller than normal, as cljs has a lot of kinks and things to avoid
which is not easy at all
Yeah. There are definitely some rough edges in cljs.
i have a stupid question, why meander use lazy collections and not for example transducers?
Not a stupid question.
I'm talking about search
It mostly has to do with scope.
Meander compiles things like (let [?x TARGET] ,,,) instead of (assoc state '?x TARGET) and, it could be my lack of imagination, but the former is hard to shoe into a transducer approach.
The latter, however, will totally work with transducers.
As I am just checking search, changing to into [] is ~2x faster
OK. Thats good information. Honestly, I think this project needs to be more accessible and problems like these should be easier to resolve with some help.
Right now, epsilon is not so great for that.
The approach I’ve tried with zeta works really well for interpretation but has proven to be too slow for macro compilation.
We'll see soon if it's too difficult. If I can handle redoing it through metadata then that means anyone could
and by the way, I'll find out how it works underneath
I think its probably the best way to sneak something from the future in.
haha, this turned into quite the conversation 😄
I agree that Meander is secret sauce, I’ve used it for some things where I just end up staring at the solution in awe cause it’s so clear and concise
it’s an incredible piece of work 😄
Awesome.
@noprompt, is there any way to debug meander? To understand what is going on and refer to the expanded code somehow?
I think I know, but I don't know at what point I can print out a sequence with operators that will later be compiled into code
Ugh, its sadly an “art”.
I may have some stuff to help.