Skip to content

Instantly share code, notes, and snippets.

@pocketberserker
Created August 12, 2012 06:30
Show Gist options
  • Save pocketberserker/3330153 to your computer and use it in GitHub Desktop.
Save pocketberserker/3330153 to your computer and use it in GitHub Desktop.
素数のときにJOJO
let isPrime = function
| n when n < 2 -> false
| n -> [2 .. n-1] |> List.forall ((%) n >> (<>) 0)
[0..100]
|> List.map (fun x -> if isPrime x then "JOJO!" else string x)
|> List.iter (printfn "%s")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment