Created
October 6, 2015 19:34
-
-
Save kristof-mattei/f6dfc249f13781f73a32 to your computer and use it in GitHub Desktop.
This file contains 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
module Engine.Functions | |
let rec Calculate columns = | |
match columns with | |
| h::[] -> [ [ h ] ] | |
| h::t -> | |
let x = Calculate t | |
List.fold (fun acc elem -> (h::elem)::acc) ([h]::x) x | |
| [] -> [] | |
let result = Calculate ["A"; "B"; "C"] | |
List.iter (fun x -> (printfn "%s" (List.fold (+) "" x))) result | |
(* | |
Gives | |
AC | |
AB | |
ABC | |
A | |
BC | |
B | |
C | |
*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment