val a : int
Full name: Sample.a
val factorial : x:int -> int
Full name: Sample.factorial
val x : int
Multiple items
module List
from Microsoft.FSharp.Collections
--------------------
type List<'T> =
| ( [] )
| ( :: ) of Head: 'T * Tail: 'T list
interface IEnumerable
interface IEnumerable<'T>
member Head : 'T
member IsEmpty : bool
member Item : index:int -> 'T with get
member Length : int
member Tail : 'T list
static member Cons : head:'T * tail:'T list -> 'T list
static member Empty : 'T list
Full name: Microsoft.FSharp.Collections.List<_>
val reduce : reduction:('T -> 'T -> 'T) -> list:'T list -> 'T
Full name: Microsoft.FSharp.Collections.List.reduce
val c : int
Full name: Sample.c
Multiple items
type MeasureAttribute =
inherit Attribute
new : unit -> MeasureAttribute
Full name: Microsoft.FSharp.Core.MeasureAttribute
--------------------
new : unit -> MeasureAttribute
[<Measure>]
type sqft
Full name: Sample.sqft
[<Measure>]
type dollar
Full name: Sample.dollar
val sizes : int<sqft> []
Full name: Sample.sizes
val prices : int<dollar> []
Full name: Sample.prices
Reveal.js
- A framework for easily creating beautiful presentations using HTML.
Atwood's Law: any application that can be written in JavaScript, will eventually be written in JavaScript.
FSharp.Formatting
- F# tools for generating documentation (Markdown processor and F# code formatter).
- It parses markdown and F# script file and generates HTML or PDF.
- Code syntax highlighting support.
- It also evaluates your F# code and produce tooltips.
Syntax Highlighting
F# (with tooltips)
1:
2:
3:
|
let a = 5
let factorial x = [1..x] |> List.reduce (*)
let c = factorial a
|
c is evaluated for you
More F#
1:
2:
3:
4:
|
[<Measure>] type sqft
[<Measure>] type dollar
let sizes = [|1700<sqft>;2100<sqft>;1900<sqft>;1300<sqft>|]
let prices = [|53000<dollar>;44000<dollar>;59000<dollar>;82000<dollar>|]
|
prices.[0]/sizes.[0]
C#
using System;
class Program
{
static void Main()
{
Console.WriteLine("Hello, world!");
}
}
|
JavaScript
function copyWithEvaluation(iElem, elem) {
return function (obj) {
var newObj = {};
for (var p in obj) {
var v = obj[p];
if (typeof v === "function") {
v = v(iElem, elem);
}
newObj[p] = v;
}
if (!newObj.exactTiming) {
newObj.delay += exports._libraryDelay;
}
return newObj;
};
}
|
Haskell
recur_count k = 1 : 1 : zipWith recurAdd (recur_count k) (tail (recur_count k))
where recurAdd x y = k * x + y
main = do
argv <- getArgs
inputFile <- openFile (head argv) ReadMode
line <- hGetLine inputFile
let [n,k] = map read (words line)
printf "%d\n" ((recur_count k) !! (n-1))
|
code from NashFP/rosalind
SQL
select *
from
(select 1 as Id union all select 2 union all select 3) as X
where Id in (@Ids1, @Ids2, @Ids3)
|
sql from Dapper
Bayes' Rule in LaTeX
\(\Pr(A|B)=\frac{\Pr(B|A)\Pr(A)}{\Pr(B|A)\Pr(A)+\Pr(B|\neg A)\Pr(\neg A)}\)