Thanks for the feedback. With a little inspiration from Avalander's Scala solution, I've got it what I had in mind in the first place.
let deafRats (s:string)= let rec inner s piper deaf = match s with | [] -> deaf | 'P' :: tail -> inner tail 1 deaf | 'O' :: '~' :: tail -> inner tail piper (deaf + 1 - piper) | '~' :: 'O' :: tail -> inner tail piper (deaf + piper) | _ :: tail -> inner tail piper deaf inner [for c in s -> c] 0 0
Nice math trick with the piper, hadn't thought of that!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for the feedback. With a little inspiration from Avalander's Scala solution, I've got it what I had in mind in the first place.
Nice math trick with the piper, hadn't thought of that!