Hi all,
Is there a multiple instances pattern in F# somewhere?
Consider that I'm working on a list. I have the following pattern matching
match l with
| [] | [_] -> l //if the list is empty or contains only one item, simply return it
|
//is there a pattern to test if all of the elements are identical?
In other words passing [] or [1] should simply return the list and so should [1;1;1;...] but I can't figure out how to pattern match that last pattern. Is this possible? Or is there a better approach that I might use? I haven't found anything anywhere about a repeating pattern.