This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let l = [1, 2, 3] | |
| |> List.map(n => n * 2) | |
| |> List.filter(n => n mod 2 != 0) | |
| |> List.tl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let selection = [1, 2, 3] | |
| |> List.map(n => n * 3) | |
| |> List.filter(n => n mod 2 == 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let integers = [1, 2, 3]; | |
| let multiples = integers |> List.map(n => n * 3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let add1 = x => x + 1; | |
| /* The following statements are equivalent: */ | |
| add1(2); | |
| 2 |> add1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Non-fluent list operations in ReasonML */ | |
| let integers = [1, 2, 3]; | |
| let multiples = List.map(n => n * 3, integers); | |
| let evens = List.filter(n => n mod 2 == 0, multiples); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Fluent collection operations in C# using IEnumerable<T> | |
| var selection = someCollection | |
| .Select(x => x * 3) | |
| .Where(x => x % 2 == 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let covers = (x, y) => sites^ |> List.exists(site => site.left <= x && site.right >= y); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let percentCovered = (x, y) => { | |
| let (x, y) = (min(x, y), max(x, y)); | |
| let amountCovered = sites^ |> List.fold_left((sum, site) => { | |
| sum +. (min(site.right, y) -. max(site.left, x)) | |
| }, 0.0); | |
| 100.0 *. amountCovered /. (y -. x); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let insert = site => { | |
| let (leftSide, rightSide) = sites^ |> List.partition(s => s.left <= site.left); | |
| let (overlap, rest) = rightSide |> List.partition(s => s.left <= site.right); | |
| let rightSide = switch(overlap) { | |
| | [] => [site, ...rightSide] | |
| | _ => let closest = overlap->List.rev->List.hd; [site->connectRight(closest), ...rest] | |
| } | |
| let site = rightSide->List.hd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type ui = { | |
| height: float, | |
| width: float, | |
| input: unit => string, | |
| calculateWidth: string => float | |
| }; |