From d9b80337ba915040c9e019db79b1ce62c736c4db Mon Sep 17 00:00:00 2001 From: Jeff Parent Date: Sun, 14 Apr 2019 01:41:21 -0500 Subject: List Matching first element of "many" Updated the pattern matching for lists to show how to get head of a list when you don't care how many other elements are in the list. --- fsharp.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fsharp.html.markdown') diff --git a/fsharp.html.markdown b/fsharp.html.markdown index 59461eed..24044d76 100644 --- a/fsharp.html.markdown +++ b/fsharp.html.markdown @@ -194,7 +194,7 @@ module ListExamples = | [] -> printfn "the list is empty" | [first] -> printfn "the list has one element %A " first | [first; second] -> printfn "list is %A and %A" first second - | _ -> printfn "the list has more than two elements" + | first :: _ -> printfn "the list has more than two elements, first element %A" first listMatcher [1; 2; 3; 4] listMatcher [1; 2] -- cgit v1.2.3