F Sharp
- Artikelns titel kan av tekniska skäl inte återges korrekt. Den korrekta titeln är F#.
F# (uttalas F Sharp) är ett funktionellt programspråk som ursprungligen utvecklades av Don Syme på Microsoft Research. Programspråket är baserat på OCaml men kombinerar även element från flera andra paradigmer såsom objektorientering och imperativ programmering på Microsofts .NET-ramverk. F# utvecklas numera av Microsoft Developer Division och är nu implementerat i Visual Studio.
Exempel
[redigera | redigera wikitext]#light
(* Fibonacci-formel *)
let rec fib n =
match n with
| 0 | 1 -> n
| _ -> fib (n - 1) + fib (n - 2)
(* Skriv ut jämna fibonacci-nummer *)
[1 .. 10]
|> List.map fib
|> List.filter (fun n -> (n mod 2) = 0)
|> printlist
(* Samma som ovan *)
[ for i in 1..10 do
let r = fib i
if r % 2 = 0 then yield r ]
|> printlist
Externa länkar
[redigera | redigera wikitext]Text is available under the CC BY-SA 4.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.