Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*
- Foreach element in fifth do
- sum elements in second filtered by matching characters in first and
- subtract elements in fourth filtered by matching characters in third
- *)
- module SOQN =
- open System
- let first = [|"A"; "B"; "C"; "D"; "E"; "F"; "G"; "H"; "I"; "J"|]
- let second = [|13.0; 17.0; 19.0; 23.0; 29.0; 0.0; 0.0; 0.0; 0.0; 0.0|]
- let third = [|"ABCD"; "ABCE"; "ABDE"; "ACDE"; "BCDE"|]
- let fourth = [|2.0; 3.0; 5.0; 7.0; 11.0|]
- let fifth = [|"ABC"; "ABD"; "ABE"; "ACD"; "ACE"; "ADE"; "BCD"; "BCE"; "BDE"; "CDE"|]
- let sixth =
- [[for i in [0..fifth.Length - 1] do
- yield (sumFunc second first fifth.[i] -
- subtractFunc third fourth fifth.[i])]]
- // Expected Result: Sixth: [| 44.0; 46.0; 51.0; 39.0; 51.0; 53.0; 46.0; 51.0; 53.0; 53.0 |]
Add Comment
Please, Sign In to add comment