Using FUN Keyword Effectively in F# Interrelated Implementation Scenario

Today, in this article we will try to implement a F# program considering the case scenario of using FUN keyword. In this program I am performing simple arithmetic calculation and display out result using simple lambda expression.

We don't waste much time in studying theory stuff. It's time to start the code.

What exactly use of List.map ?

This creates basically we could something like it creates some code collection where its elements are applied to function where logic is specified.

What's Exactly Use of FUN?

It enables to define some lambda expressions within our inline code.

The Complete Code of this Application looks like this:

open System

 

let n = 77

let nadd = n + n

let nmin = n - n 

let nmul = n * n

let ndiv = n / n 

let list = List.map (fun n -> n + n )[nadd; nmin ; nmul; ndiv] 

printfn "The Add, Sub, Mul, Div Operations of Given Numbers are as Follows:\n\n%A" list

Console.ReadKey(true)

The Output for this application looks like this:

pic2.gif

I hope this article is useful for you. I look forward for your comments and feedback.

Ebook Download
View all
Learn
View all
MVC Corporation is consulting and IT services based company.