Sha256: 2baed122b9994baf74f77352ccadfe27f935af4e7a44c3bf88e8b9745bb7ad63
Contents?: true
Size: 332 Bytes
Versions: 98
Compression:
Stored size: 332 Bytes
Contents
module Trinary let isValid char = match char with | '0' | '1' | '2' -> true | _ -> false let charToDecimal char = (int)char - (int)'0' let toDecimal(input: string) = let chars = input.ToCharArray() if Array.forall isValid chars then Array.fold (fun acc c -> acc * 3 + charToDecimal c) 0 chars else 0
Version data entries
98 entries across 98 versions & 1 rubygems