Matching of tuples
- by Jack
From what I understood I can use pattern-matching in a match ... with expression with tuples of values, so something like
match b with
("<", val) -> if v < val then true else false
| ("<=", val) -> if v <= val then true else false
should be correct but it gives me a syntax error as if the parenthesis couldn't be used:
File "ocaml.ml", line 41, characters 14-17:
Error: Syntax error: ')' expected
File "ocaml.ml", line 41, characters 8-9:
Error: This '(' might be unmatched
referring on first match clause..
Apart from that, can I avoid matching strings and applying comparisons using a sort of eval of the string? Or using directly the comparison operator as the first element of the tuple?