Last active
February 9, 2023 23:17
-
-
Save ruxo/3e8d7d705a09c7f6c370 to your computer and use it in GitHub Desktop.
Array element combination
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 combinationPair array = | |
| seq { | |
| let L = Array.length array | |
| for i = 0 to L-2 do | |
| let first = array.[i] | |
| for j = i+1 to L-1 do | |
| yield first, array.[j] | |
| } | |
| let combinationDoubleSeq a1 a2 = a1 |> Seq.collect (fun x -> a2 |> Seq.map (fun y -> x,y)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment