مقدمه ای بر f#

Click here to load reader

Post on 08-Apr-2017

40 views

Category:

Technology

0 download

Embed Size (px)

TRANSCRIPT

Developing a Windows 8 application with F#

Introduction in MicrosoftF#By Shahriar Yazdipour

#F () ( ) ( F# kernel ... .) ML OCaml, C#, Haskell, Scala and Erlang

. IPL 1955( ) . LISP 1958( ) . . 1970 .#F . . . #F . Lisp Haskel OCaml ( #F ) . .2

LISPISWIMAPLFPML19581966196219771973Haskell1988Scala2003Ocaml1996F#2005Clojure20071930Erlang1986Lambda

OCAML . . #F . .Net VisualStudio .

#F . #F . #F OCAML . #F . #F . #F VisualStudio .4

Functional + OO + .NET + Open Source =>The Most Powerful Language In The WORLD! #F

#F #F . #F . ( . .) WPF Silverlight . syntax #F . ( )

#F . #F . :#F . . . .#F . #F WPF Silverlight . syntax #F . Paython .#F #C VB . . #F Unit Measure Bug . VS.Net #F (unitTesting debuging ..) .#F data-mining .#F immutability .( ).....6

#F #F #C VB . . #F Unit Measure Bug . (unitTesting debuging ..) .#F data-mining . immutability

ScalaClojureF#Erlang

Mac OS X Linux Windows

iOS WindowsPhone Android

GPU JS F#

IDE

Visual Studio(Since 2010)XamarinStudioMonoDevelopEmacs

10

F# : F# C# C++ Java Android WinRT WindowsPhone iOS Python PHP Ruby NodeJS

F# :

110 11000 300 . 90 18 SQL . . . .

Feekback . #F SQL MATLAB . #C .

F# : Halo : Eyenaemia ) ImagineCup ) AutoCat http://goo.gl/Glu2mX Derivative One

#F syntax #F #F VS.Net Visual . . WinRT

#F

#F . ( ).

syntax #F ( ) . . #F ( ) instance cast .( ). #F VS.Net Visual .( drag drop ....). . #F #C VB

. ( ) #F #C . #F ( ) ( ...) #C VB.14

C# vs F#typeVector(x : float, y : float) =memberthis.X = xmemberthis.Y = ynew(v : Vector, s) = Vector(v.X * s, v.Y * s)// Usage:letv = Vector(10., 10.)letw =newVector(v, 0.5)

Ex: Multiple constructorspublicclassVector{ doublex; doubley; publicVector(doublex,double y) { this.x = x; this.y = y; } publicVector(Vectorv,doubles) :this(v.x * s, v.y * s) { }}// Usage:Vectorv =newVector(10, 10);Vectorw =newVector(v, 0.5);F#C#Ref:http://goo.gl/lgjrjc

TestC#F#IronPythonLinesTime (Sec)LinesTime (Sec)LinesTime (Sec)binarytrees812.146667433.8813334431.90967Nbody1690.2821150.57266713232.909Nsieve400.527667391.1646673015.93933Pidigits[1]5915.4193911.02267recursive467.595333346.37738[2]fannkuch7614.602334912.4206749829.6697partialsums423.191303.48133346586.463

Ref http://goo.gl/1aPwWt

The versions of each compiler used where:C# 4//6 RCF# 1.9.1.18 //3.1IronPython 1.1 //2.7

Try F# Onlinehttp://www.tryfsharp.org/

DemoVariables & ArraysRecursive functionsRecursive + Thread + Do WhileRecordDataType,Array ,FormAvalaible on : https://github.com/yazdipour/An-Introduction-to-F-Sharp-Demos

F#vs.C#vs.PythonF# vs. Go vs. ScalaF# vs C# (details) F# vs C# (num code line) F# fsharp.netAn Introduction to MicrosoftF#