Using unapply() / active patterns for parsing

2 views
Skip to first unread message

Mike Austin

unread,
Nov 20, 2021, 10:27:18 AM11/20/21
to PiLuD
https://gist.github.com/davidandrzej/2969461

It seems like you could build a complete parser out of Scala’s unapply or F#’s active patterns, which allow you to create custom pattern matching extractors.

Raoul Duke

unread,
Nov 20, 2021, 11:45:56 AM11/20/21
to pi...@googlegroups.com
or NAND gates. :-)

On Sat, Nov 20, 2021 at 07:27 Mike Austin <mike.aus...@gmail.com> wrote:
https://gist.github.com/davidandrzej/2969461

It seems like you could build a complete parser out of Scala’s unapply or F#’s active patterns, which allow you to create custom pattern matching extractors.

--
You received this message because you are subscribed to the Google Groups "PiLuD" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pilud+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pilud/f75dfb59-260b-48cc-8d64-ccfde2b062f4n%40googlegroups.com.

Mike Austin

unread,
Nov 20, 2021, 11:52:11 AM11/20/21
to PiLuD
NAND gates using pattern matching? Crazy! ;)

Someone did write an example of using F# active patterns tow write a parser:

David Barbour

unread,
Nov 20, 2021, 6:44:41 PM11/20/21
to pi...@googlegroups.com
I frequently use active patterns for parsing. 

On Sat, Nov 20, 2021, 9:27 AM Mike Austin <mike.aus...@gmail.com> wrote:
https://gist.github.com/davidandrzej/2969461

It seems like you could build a complete parser out of Scala’s unapply or F#’s active patterns, which allow you to create custom pattern matching extractors.

--

Mike Austin

unread,
Nov 21, 2021, 3:02:15 AM11/21/21
to PiLuD
Nice. They seem like a perfect fit for parsing - match and extract.
Reply all
Reply to author
Forward
0 new messages