[Solved] F# : not sure how to start [closed]


3.

type Line = {a:double; b:double}

let LinesIntersection x y = 
    if x.a <> y.a then 
        Some ((x.b - y.b)/(y.a - x.a), (y.a*x.b - x.a*y.b)/(y.a - x.a))
    else None

let l1 = {a = 2.0; b = -3.0}
let l2 = {a = -3.0; b = 2.0}
let l3 = {a = 2.0; b = 4.0}

LinesIntersection l1 l2 |> printfn "%A"
LinesIntersection l1 l3 |> printfn "%A"

Print:

Some (1.0, -1.0)
<null>

Link: https://dotnetfiddle.net/uNcTEL

The rest do yourself. Does not work – show an attempt solutions

1

solved F# : not sure how to start [closed]