meander

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

Ah, yeah, readability is kind of hard to address because folks have different notions of what that means. However, I would argue that having a large LHS and RHS is maybe not so bad.

timothypratley 2020-03-11T00:00:47.151Z

FWIW I’ve had good success with defsyntax (see original thread for example), and with using (m/app) to do futher transformations.

noprompt 2020-03-11T00:00:53.151200Z

But, again, that perspective is context sensitive.

noprompt 2020-03-11T00:01:05.151700Z

Oh, yeah, thats a nice way to do it.

noprompt 2020-03-11T00:01:20.152100Z

Actually, I recently used defsyntax for just that purpose

ezmiller77 2020-03-11T00:01:21.152300Z

Hmmm I was wondering about this. Thanks @timothypratley

ezmiller77 2020-03-11T00:01:47.153200Z

I see what you mean. It is subjective indeed.

noprompt 2020-03-11T00:01:52.153500Z

(defsyntax cool-thing [?a ?b]
  {:a ?a :b ?b})
Would give you the ability to match and substitute with cool-thing.

ezmiller77 2020-03-11T00:02:47.154100Z

Why do you here use those arguments [?a ?b]?

noprompt 2020-03-11T00:03:00.154500Z

(m/defsyntax cool-thing [?a ?b]
  {:a ?a :b ?b})

(m/match {:a 1 :b 2}
  (cool-thing 1 ?b)
  ?b)
;; => 2

(m/rewrite {:a 1 :b 2}
  (cool-thing ?a ?b)
  (cool-thing [?a ?a] [?b ?b]))
;; => {:a [1 1], :b [2 2]}

noprompt 2020-03-11T00:03:25.154800Z

Out of habit. 🙂

ezmiller77 2020-03-11T00:04:23.156Z

Nice

ezmiller77 2020-03-11T00:04:32.156400Z

Gonna give this a try.

noprompt 2020-03-11T00:05:56.158600Z

If anything isn’t clear in the docs or if you want to improve them etc. open a ticket, pull request, or chat here. 🙂

timothypratley 2020-03-11T00:06:58.159600Z

Here’s an example of what I mean by m/apphttps://github.com/timothypratley/happygapi/blob/master/dev/happy/beaver.clj#L154 which can be handy if you have deeply nested stuff that you just don’t want to think about 🙂 i.e. defsyntax is great for breaking up patterns but at some point you still have to put them back together somehow so if the putting togeter and pulling apart are colocated I think m/app wins in those cases /shrug

ezmiller77 2020-03-11T00:08:37.160500Z

Thanks to you both for the quick responses. Gonna study these links.

noprompt 2020-03-11T00:10:11.162Z

Definitely! I think you will find folks here to be helpful. Its rare that a question gets left on the stack without a response.

noprompt 2020-03-11T00:12:02.162600Z

Coincidentally, I do need to step away for a moment. 🙂

noprompt 2020-03-11T05:35:23.164600Z

https://github.com/noprompt/meander/pull/117

noprompt 2020-03-11T05:37:27.166800Z

Normally I might commit this and release, but there were other folks involved in the previous discussions and I want to give them (and others) a chance to share any thoughts before I merge. Tim, I’m looking at you. 🙂

timothypratley 2020-03-11T13:15:08.167200Z

I’ll play around with it tonight

timothypratley 2020-03-12T01:46:11.168700Z

works as advertised :thumbsup: