Headline

Basics of programming in F# and .NET

Characteristics

Multiparadigm nature of F# is shown; both OO and FP features of the languages are illustrated by adjusting a basic C# implementation.

Illustration

    type Company() = 
     class
       let mutable name = ""
       let mutable departments:List<Department> = new List<Department>() 
  
       member this.Name with get() = name and set v = name <- v
       member this.Departments with get() = departments and set v = departments <- v

Here we define a member which is essentially a wrapper around pure functional style of calculating total using accumulator. (fold function from F# library is used)

 member this.TotalSalaries =
        let x = List.fold (fun (acc) (elem:Department) -> acc + elem.Total) 0M (List.ofSeq departments)
        x

Architecture

Usage

To make NUnit GUI working with .NET 4.0 Under <configuration></configuration> add: <startup>

  &lt;supportedRuntime version&#61;&quot;v4.0.30319&quot; /&gt;

</startup>

and under <runtime></runtime> add: <loadfromremotesources enabled="true"></loadfromremotesources>

The implementation has been tested with:

  • F#: Programming language used for all code (Version 2.0)
  • F# compiler (Version 2.0)
  • .NET Framework used to execute compiled code (Version 4.0)
  • NUnit testing framework used for testing (Version 2.5)
  • Visual Studio: optional IDE (Version 2010)

Metadata


There are no revisions for this page.

User contributions

    This user never has never made submissions.

    User edits

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.