Closed danostrowski closed 5 years ago
Wow, nice indeed. Seconded.
As a side note, also MacroPy3 provides pattern matching. Granted, there are many attempts at pattern matching for Python - see e.g. the links in the README of the recently resurrected pypatt - but I think MacroPy does it differently enough to merit a mention.
In Pampy, the action must be an expression, which limits what is conveniently doable, but it's built on pure Python and (at least at a quick glance in the source) the implementation looks very pythonic.
MacroPy's with switch
, on the other hand, locally makes if
into a binding construct. It's convenient for inlining lots of short actions that use the full power of Python (including features only available as statements). But a complete syntactic macro system can be a hard sell.
Both solutions have their advantages. It's nice to see an easily approachable and documented pattern matcher built on pure Python!
Done.
One of the most useful things in functional programming I've come across is pattern matching, and Pampy seems to do a good job of it.
https://github.com/santinic/pampy
Consider adding this? I'm in a time crunch or I'd make a PR, but I just wanted to get this mentioned somewhere.