From 2dbfcc8faf8c5f1b144a0b0387ac545bf17a3a75 Mon Sep 17 00:00:00 2001 From: Foo Chuan Wei Date: Tue, 26 Jun 2018 17:43:39 -0400 Subject: Fix sentence mistake in fsharp.html.markdown --- 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 bbf477ba..dd85552d 100644 --- a/fsharp.html.markdown +++ b/fsharp.html.markdown @@ -306,7 +306,7 @@ module DataTypeExamples = // ------------------------------------ // Union types (aka variants) have a set of choices - // Only case can be valid at a time. + // Only one case can be valid at a time. // ------------------------------------ // Use "type" with bar/pipe to define a union type -- cgit v1.2.3 From 681bf26320b3540e65d6afa159d3374290c42e69 Mon Sep 17 00:00:00 2001 From: Lorenzo Bragaglia Date: Thu, 20 Sep 2018 00:10:08 +0200 Subject: [fsharp/en] Add note on equality operator Add a note pointing out the use of single char "=" equality operator. --- fsharp.html.markdown | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'fsharp.html.markdown') diff --git a/fsharp.html.markdown b/fsharp.html.markdown index dd85552d..59461eed 100644 --- a/fsharp.html.markdown +++ b/fsharp.html.markdown @@ -34,7 +34,7 @@ let myFloat = 3.14 let myString = "hello" // note that no types needed // ------ Lists ------ -let twoToFive = [2; 3; 4; 5] // Square brackets create a list with +let twoToFive = [2; 3; 4; 5] // Square brackets create a list with // semicolon delimiters. let oneToFive = 1 :: twoToFive // :: creates list with new 1st element // The result is [1; 2; 3; 4; 5] @@ -53,7 +53,8 @@ add 2 3 // Now run the function. // to define a multiline function, just use indents. No semicolons needed. let evens list = - let isEven x = x % 2 = 0 // Define "isEven" as a sub function + let isEven x = x % 2 = 0 // Define "isEven" as a sub function. Note + // that equality operator is single char "=". List.filter isEven list // List.filter is a library function // with two parameters: a boolean function // and a list to work on -- cgit v1.2.3 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 From aaea037ba47492d0b4f475eb3b5986930081a812 Mon Sep 17 00:00:00 2001 From: fighou Date: Wed, 18 Sep 2019 10:46:17 +0200 Subject: Update fsharp.html.markdown --- 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 24044d76..064a9fdd 100644 --- a/fsharp.html.markdown +++ b/fsharp.html.markdown @@ -14,7 +14,7 @@ The syntax of F# is different from C-style languages: * Curly braces are not used to delimit blocks of code. Instead, indentation is used (like Python). * Whitespace is used to separate parameters rather than commas. -If you want to try out the code below, you can go to [tryfsharp.org](http://www.tryfsharp.org/Create) and paste it into an interactive REPL. +If you want to try out the code below, you can go to [https://try.fsharp.org](https://try.fsharp.org) and paste it into an interactive REPL. ```csharp -- cgit v1.2.3