-
-
Save OdaShinsuke/2349771 to your computer and use it in GitHub Desktop.
WEB+DB PRESS Vol.67 第2章 F#
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 ret1 = List.zip [0..4] [10;20;30;40;50];; | |
| let mul (i, x) = x * i;; | |
| let ret2 = List.map mul ret1;; | |
| let calc xs = List.fold (fun acc value -> acc + value) 0 (List.map mul (List.zip [0..4] xs));; | |
| calc [10;20;30;40;50];; |
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
| List.zip [10;20;30;40;50] [0..4] | |
| |> List.map (fun x -> fst x * snd x) | |
| |> List.fold (fun acc value -> acc + value) 0;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment