Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Validar en F#
let validar tam accion =
let cars = [for c in accion -> c]
if List.exists (fun c -> not (Char.IsDigit c)) cars then List.empty<int>
else
let org = List.map (fun c -> (int c) - (int '0')) cars
let num = List.distinct org
if (List.length org <> List.length num) || (List.length num <> tam) then List.empty<int>
else num
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment