Advertisement
biswasrohit20

te

May 20th, 2021
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. open System
  2.  
  3.  
  4.  
  5. let pclCollect (list) =
  6. let mutable output = []
  7. let mutable temp = []
  8. let mutable pre = list.Head
  9. for element in list do
  10. if element = pre then
  11. temp <- [element] |> List.append temp
  12. pre = element
  13. else
  14. output <- [temp] |> List.append output
  15. temp <- []
  16. temp <- [element] |> List.append temp
  17. pre = element
  18.  
  19. output <- [temp] |> List.append output
  20. output
  21.  
  22.  
  23.  
  24.  
  25.  
  26. printfn "%A" (pclCollect (['p'; 'p'; 's'; 'c'; 'a'; 'l';'a';'p';'c';'l';'y']))
  27. Console.ReadKey() |> ignore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement