I have some SML code trying to match for specific strings for a project but I can't get this case statement to work (previously had if statements but after 3 it was going to be too messy).
case op_name of
"pair" => print "some pair"
| "equal" | "member" | "union" => print "some operation"
| _ => print "failed"
Currently I'm getting an error Error: syntax error: replacing BAR with DARROW
on the second-last line after the | but I can't find any reference of this sort of Case in SML so I was just trying something I imagined could work.
I'm trying to essentially get the equivalent of C code
switch(input) {
case 5:
printf("some pair");
break;
case 6:
case 7:
case 8:
printf("some operation");
break;
default: printf("failed");