Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open System
- let pclCollect (list) =
- let mutable output = []
- let mutable temp = []
- let mutable pre = list.Head
- for element in list do
- if element = pre then
- temp <- [element] |> List.append temp
- pre = element
- else
- output <- [temp] |> List.append output
- temp <- []
- temp <- [element] |> List.append temp
- pre = element
- output <- [temp] |> List.append output
- output
- printfn "%A" (pclCollect (['p'; 'p'; 's'; 'c'; 'a'; 'l';'a';'p';'c';'l';'y']))
- Console.ReadKey() |> ignore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement