Created
October 8, 2017 19:26
-
-
Save celsojr/e3a61c2136d87f145b1510fb8fae0f94 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
open System | |
let (<->) x y = 2 * x + y = 1 | |
let a = [ -1..5 ];; let b = [ -3..8 ];; | |
let axb = a |> List.collect (fun c -> b |> List.map (fun d -> c,d)) | |
|> List.choose (fun (a,b) -> | |
match (a,b) with | |
| x when a <-> b -> Some(a,b) | |
| _ -> None) | |
let imr = axb |> List.map (fun (a,b) -> b) | |
[<EntryPoint>] | |
let main argv = | |
Console.OutputEncoding <- System.Text.Encoding.UTF8 | |
printfn "Relação R(A,B) = { %s }" (axb |> List.map string |> String.concat "; ") | |
printfn "Única alternativa correta: Im(R) = { %s }" ((List.sort imr) |> List.map string |> String.concat "; ") | |
0 // return an integer exit code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment