Home
Insert
Update snippet 'Wicked way to solve quadratic equation using list of operators'
Title
Passcode
Description
This is to demonstrate that: (1) there are many ways to solve the same problems; (2) operators can be grouped together into data structures and act as data; (3) you can have fun in F# in many ways.
Source code
let solve a b c = let D = b*b-4.*a*c in [(+);(-)] |> List.map (fun f -> (f -b (sqrt D))/2./a) solve 1.0 2.0 -3.0
Tags
lists
learning f#
wicked
lists
learning f#
wicked
Author
Link
Reference NuGet packages
If your snippet has external dependencies, enter the names of NuGet packages to reference, separated by a comma (
#r
directives are not required).
Update