Fsharp: Difference between revisions

Klinger (talk | contribs)
m Category Applications removed
DHCP (talk | contribs)
m Usage: improve highlighting (though i had to create 2 separate adjacent code blocks for different language highlighting. maybe that's bad?)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
[https://fsharp.org/ F#] (F-Sharp) is a .NET language.
= Usage =
= Usage =
F# is packaged in the <code>dotnet-sdk</code> family of packages (<code>dotnet-sdk_3</code>, <code>dotnet-sdk_5</code>, and <code>dotnet-sdk_7</code> as of Dec 20, 2022).
F# is packaged in the <code>dotnet-sdk</code> family of packages (<code>dotnet-sdk_3</code>, <code>dotnet-sdk_5</code>, and <code>dotnet-sdk_7</code> as of Dec 20, 2022).


You can pop into a REPL:
You can pop into a REPL:
<pre>
 
<syntaxhighlight lang=console>
$ nix-shell -p dotnet-sdk
$ nix-shell -p dotnet-sdk
warning: unknown setting 'experimental-features'
warning: unknown setting 'experimental-features'
Line 13: Line 16:


For help type #help;;
For help type #help;;
</syntaxhighlight>


<syntaxhighlight lang=fsharp>
> printfn "Hello world from F#!";;
> printfn "Hello world from F#!";;
Hello world from F#!
Hello world from F#!
val it : unit = ()
val it : unit = ()
</pre>
</syntaxhighlight>


To create a project use
To create a project use


<pre>
<syntaxhighlight lang=console>
dotnet new console --language F#
$ dotnet new console --language F#
dotnet run
$ dotnet run
</pre>
</syntaxhighlight>


like so!
like so!