I started a new page: https://github.com/noprompt/meander/wiki/How-To with the intention of allowing people to contribute little snippets that demonstrate putting meander concepts into practice
Yup, works - but it's worth noting that, like the wiki, I'd still probably wouldn't add to it without consulting this channel first!
@timothypratley Had a look at it now. Exactly the kind of thing I need, thanks! Would prefer if all examples also included output though.
This is awesome! I'd like to recommend erring on the side of too many examples rather than too few. On the one hand, having tons of examples makes it difficult to keep them up-to-date as the library evolves. But on the other hand, with Meander, I typically spend the 80% of my time on the one or two transformations that aren't obvious, so having a large library of examples to scan could really cut down on that time and improve efficiency for new users (might also help @noprompt and @jimmy distill best practices/steer the library). Thoughts?
Yeah feel free to make as many changes as you'd like. I plan on contributing some. We can review things if there isn't anything that isn't recommended. But for a cookbook the more you can add the better.
I think if we can collect a lot of use cases it will help funnel people to the right concepts to explore. I know that I often have a āgoalā in mind where Iām not sure what primitives I need to draw on.
Iāve never really set up a github wiki before so Iād like to knowā¦ can everyone edit this or only āblessedā contributors? Iām hoping everyone because that was the idea.
@timothypratley only "blessed" contributors! (confirmed while logged in)
Ah damn, any suggestions on a more contribution friendly medium? @aisamu thank you for trying it.
@noprompt or @jimmy can you open this up following these instructions: https://help.github.com/en/github/building-a-strong-community/changing-access-permissions-for-wikis please? (assuming you are O.K. with allowing anyone to edit š )
I don't have permissions either. Up to Joel.
@timothypratley I would prefer not to use the Github Wiki.
ah ok no problem
@timothypratley Sorry, I hit enter before I could finish my thoughtā¦ I would prefer to have everything documentation/tutorial related checked in under the doc/
folder. I donāt like having multiple sources of docs, etc.
Yeah, how about doc/HOWTO.md for now?
Sure, thats perfectly fine with me.
Iām thinking if itās just a receipy book people will feel more empowered to add to it than a tutorial
and you can submit a PR from the github editor pretty easily so honestly not much different from a wiki
The examples/
folder is another nice place.
For REPL like stuff, yes, please put that in a Cookbook.md
kinda thing.
Iām not a fan of the Wiki pages because they tend to get out of sync with the project no matter how good peopleās intentions are.
OK, Iāll make a PR
Also, its nice to be able to clone the repository and have all of that stuff come down with it.
yeah for sure!
Yeah cookbook.md would be good. We can merge things pretty easily for that.
@noprompt it seems I can create the wiki but not destory it hahaha so just letting you know I have the text, please nuke it š
To close out this thread; the new location is https://github.com/noprompt/meander/blob/epsilon/doc/cookbook.md ^^ @aisamu it would be great if you could try the Github āedit this fileā and confirm that that is āreasonably convenientā or at least works?
I thought this was fun enough to share:
[?v ?x (m/and ?m (m/or {?x ?v} {?x _ & ?m}))]
The value of ?x
is ?v
or ?x
is not in the map ?m
.> & ?m :as ?m
Is the ?m
being overwritten?
(i.e. is "collect the rest into ?m
, but then rebind the whole map as ?m
" a correct reading ?)
(I tried it on a REPL but got: Every pattern of an or pattern must have references to the same unbound logic variables.
)
No, the ?m
is not being overwritten. Logic variables are only unbound/rebound by backtracking. But I realize now I took my example out of context so let me fix that. š
(m/rewrite [1 'x {'x 0}]
[?v ?x (m/and ?m (m/or {?x ?v} {?x _ & ?m}))]
?m)
;; => nil
(m/rewrite [1 'x {'x 1}]
[?v ?x (m/and ?m (m/or {?x ?v} {?x _ & ?m}))]
?m)
;; => {'x 1}
(m/rewrite [1 'x {}]
[?v ?x (m/and ?m (m/or {?x ?v} {?x _ & ?m}))]
?m)
;; => {}
That makes way more sense, thanks!
So, in ref to https://github.com/noprompt/meander/issues/106, how does rewrite's arity work? I thought it had to be an even arity, but @timothypratley showed an example of an odd arity.
Replied to the issue. Will work on expanding some docstrings and docs if I can find time today.
Aaaah, that explains my confusion.
If you look at Tims example, he calls strategy m
, not the main namespace. I've usually called it r
. But it should maybe have a better name? r
was Joel's go to for a while. I think I was the one use started using m for meander. r stood for rewrite.
Ultimately, we should have better standard aliases, but this is a problem in the clojure community in general. Is clojure.string s
or str
or string
?
Example: https://clojurians.slack.com/archives/CFFTD7R6Z/p1577902861109300
Yeah, it's tricky. But I'm sure patterns will emerge over time.
Sorry for the confusion; Iām not sure what the āstandardā is or should be but I propose maybe strategy/rewrite
and m/rewrite
is also worth considering as āmost stuff is in mā
I would use meander/rewrite
except that then I have to write meander/$
etc for ops
Iād rather write $
hahahaha