Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let n = 4
- let myList1 = ["aaa"; "b"; "ccc"]
- let rec func (list : string list) (myList : string list) =
- match list with
- | head :: tail -> match myList with
- | myHead :: myTail -> if myHead.Length + head.Length <= n then
- func tail ((myHead + head) :: myTail)
- else func tail (head :: myList)
- | [] -> func tail [head]
- | [] -> myList |> List.rev
- let myList2 = func myList1 []
- printfn "%A" myList2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement