seconddayout
seconddayout

Reputation: 29

Does SML support guards on patterns within match expressions?

I've in mind something akin to the F# mechanism described here. In looking into it, I've found nothing explicitly saying it does nor that it doesn't.

Upvotes: 0

Views: 432

Answers (1)

ruakh
ruakh

Reputation: 183270

Neither the Definition of Standard ML from 1990 nor the Definition of Standard ML (Revised) from 1997 defines pattern guards.

There have been some proposals to support them — see https://github.com/SMLFamily/Successor-ML/wiki/Summary-of-proposed-changes — but I think the only implementation that does so is 'HaMLeT S'. In particular, neither MLton nor SMLNJ seems to support them (see http://mlton.org/SuccessorML and https://smlnj.org/doc/features.html, respectively).

Upvotes: 3

Related Questions