Created
June 13, 2013 20:11
-
-
Save thisiswei/5776932 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fun getFinal init res = | |
let | |
fun helper total bet n = | |
case n+1 > size res of | |
true => total | |
| _ => if String.sub (res, n) = #"L" | |
then helper (total-bet) (bet*2) (n+1) | |
else helper (total+bet) 1 (n+1) | |
in | |
helper init 1 0 | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment