the integral of a function f : R n R over a (parametrized) path (a path integral),
F# Path to Relaxation
Transcript of F# Path to Relaxation
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 1/88
| Basel
The F# Path toRelaxationLanguage Design, Tools, Platforms, Community, Ecosystem,Exosystem, Oenness, Cross!latform, "
Don yme, F# Community Contri$utor
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 2/88
% &entle troll Through the Lan' of LaDesign an' Deli(ery
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 3/88
% starting osition")
The great 'isutes of comuter scishoul' $e struggle' *ith
They are chances to ma+e a $etter, smore relaxe' *orl' as much as cre
oosing cams
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 4/88
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 5/88
-ou can of course ta+e this too f
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 6/88
0 -?
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 7/88
Functional 1nter
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 8/88
Then 23445/
Functional languages *ere isolate', n
interoera$le, using their o*n 67s) 1ntstan'ar's li+e C!calls, CO7, CORB%, 07L
mess for language!integration)
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 9/88
The F# %roach 2also cala, *ift
Em$race in'ustry!stan'ar' runtime layers, an'
them) 9ee exosystem at an aroriate 'istanc*ith en'!to!en' intero in min') Comromise
nee'e')
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 10/88
Relaxation %chie(e', 344: ;
; To'ay<s FP languages are immensely intero
*hile staying true to FP rinciles); F# tye ro(i'ers raise intero to a comlet
le(el
= ome tensions remain > not all functional techni?ues are easily imlementestan'ar' 67s
Functional
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 11/88
0 -?
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 12/88
Enterrise
Oens
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 13/88
TL@DR > Ahere *e are no*
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 14/88
1n one year, *e<(e come along *ay
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 15/88
The F# Comiler > 544 Pull Re?uesrising
Ahere to Contri$ute
ee fshar)githu$)io
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 16/88
The F# Language Design Proc
fslang)user(oice)com
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 17/88
F# )4
; True shift to cross!latform oenengineering
; Long laun'ry list of language items; ormalie' core li$rary; Tye ro(i'ers more o*erful
; Better 'e$ugging, tooling, erformance
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 18/88
The F# Comiler er(ice
fshar)githu$)ioHFhar)Comiler)er(ic
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 19/88
Relaxation %chie(e' ;
Enterrise Iuality Oenness
Community Tooling Ecosystem E(olution PathJ
&oo'ness
Enterrise
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 20/88
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 21/88
Functional O$Kec
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 22/88
Then 23445/
1n the MM4s functional languages *ere hisanti!OO
E(en to'ay any mention of o$Kects gi(es some eoNurrgghhh" reaction)
7o'ern Comiler 1mlementation *ith tan'ar' 7L ! CO$Kect Oriente' Programming
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 23/88
F# ! O$Kects Functional
type Vector2D (dx:double, dy:double) =
let d2 = dx*dx+dy*dy
member v.DX = dx
member v.DY = dy
member v.Lengt = !"rt d2
member v.#c$le(%) = Vector2D (dx*%, dy*%)
Inputs to objeconstructio
Exported prope
Exported met
Object intern
O$K
Constructed Class Types
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 24/88
O$Kects
Object Interface Types
type IObject =&nter'$ce ISimpleObject
$b!tr$ct Prop1 : type $b!tr$ct Meth2 : type -> type
Object Expression
{ ne IObject &t member x.Prop1 = expr
member x.Meth1 args = e
{ ne Object() withmember x.Prop1 = expr
&nter'$ce IObject &t member x.Meth1 args = &nter'$ce Ii!"et &t member x.Meth1 args =
Constructed Class Types
type Object#$pe(args) = let i%ter%&l'&le = expr
let i%ter%&l%ctio% args = expr let mut$ble i%ter%&lSt&te = expr member x.Prop1 = expr member x.Meth2 args = expr
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 25/88
The F# aroach is to em$race o$Kects,them t *ith the exression!oriente' ty
functional ara'igm
esecially for intero an' soft*are engineering ur
$ut not em$race full No$Kect!orientation
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 26/88
Expression-oriented
No null MultipleArgs =Tuples
ClosureandCapture
irst-class!alues
Curr"in
%oid
&unit'
ObjectT"pes
(ubt"ping
)ot-notation
Inheritance
MethodO%erloding
Q
*elati%e)eg
&some t"pne
*elati%el" +race$ul)egradation
&some t"pe annotationsneeded'
Functional
O$ Kects
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 27/88
% l i
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 28/88
%n analysis 2imon Cousins, Energy ector/
5S4,444lines of C# OO
$y oshore team
54,444lines of ro$ust F#, *itarallel more featur
%n alication to e(aluate the re(enue 'ue from Balancing er(ices contracts in the 9 energy in'ustry
htt.HHsimontcousins)aure*e$sites)netH'oes!the!language!you!use!ma+e!a!'ierence!re(isite'H
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 29/88
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 30/88
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 31/88
imon Cousins, Energy ector
Uero$ugs in 'eloye' system
NF# is the safe choice for this rany other choice is too ris+y
%n alication to e(aluate the re(enue 'ue from Balancing er(ices contracts in the 9 energy in'ustry
htt.HHsimontcousins)aure*e$sites)netH'oes!the!language!you!use!ma+e!a!'ierence!re(isite'H
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 32/88
Positi(e ynthesis %chie(e'
some limitations remain" an' there is one area in
that<s *orth 'iscussing")
Functional
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 33/88
Circularities an' 7o'ularity in th
2%nalysis $y cott Alaschin an' F# Com
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 34/88
7ixe' OOHFunctional ProgramVas Aon
Lam$'as in C#, Wa(a, C, "%sync mona'ic mo'ality in C#, Wa(ascri
2Vac+/, "
Function tyes in C# Tyecrit
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 35/88
nnecessary Circularities are E(il
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 36/88
nnecessary Circularities are E(il
To the functional rogrammer, it is No$(ious soft*are metho'ology shoul' hel minimie a
re'uce c clic 'e en'encies in ro ram struct
The C# aroach to circularity
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 37/88
The C# aroach to circularity
%ll les in an Nassem$ly are mutually referen
%r$itrary circularity $et*een Ninternal itemsassem$ly
7utually recursi(e Nassem$lies are ossi$le har'
The F# aroach to circularity
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 38/88
The F# aroach to circularity
Li+e Vas+ell an' OCaml, F# has a le or'erin
F# encourages minimiing 'een'encies *ith
Parameteriation the referre' techni?ue
F# o$Kects suort limite' forms of circularitynee'e'
Let<s analyse some C# an' F#
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 39/88
Let s analyse some C# an' F#roKects
Let<s analyse some C# an' F#
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 40/88
Let s analyse some C# an' F#roKects
F# co'e has fe*
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 41/88
le(el 'een'enc
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 42/88
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 43/88
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 44/88
Ahy the 'ierence $etF#
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 45/88
F#
1n C#, there is nothing from creating cycles) 1nha(e to ma+e a secia
a(oi' them)
1n F#, you canXt easily at all)
(pec
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 46/88
(pec
Tic/l
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 47/88
Tic/l
Tic+
7icro
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 48/88
Tic+
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 49/88
1n theory an' in ractice, unmo'erate'
comonent cycles are a 'isaster
Language mechanisms that enforce acyclNgoo'
There are signicant unresol(e' tensions the maKor in'ustrial languages
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 50/88
Pattern
7atching
%$stra
n
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 51/88
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 52/88
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 53/88
Enter F# %cti(e Patterns"
2imilar to cala extractors, 'esigne' at the same time in loose c
%cti(e Patterns in F#
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 54/88
let m l'i&*ect c1 c2 =m &tch c1+c2 w ith , *ect(&r+&i)+ *ect(br+bi)->
re&te*ect(&rbr - &ibi+ &ibr / bi&r)
let (,*ect,) (x:com plex) = (x.*e&l+ x.Im &"i%&r$)let (,Pol&r,) (x:com plex) = (x.M &"%it!e + x.Ph&0e)
T*o (ie*s on comlex nu
let m l'i&Pol&r c1 c2 =m &tch c1+c2 w ith , Pol&r(r1+th1)+Pol&r(r2+th2)->
re&tePol&r(r1r2+ th1/ th2)
let m l'i&*ect (*ect(&r+&i)) (*ect(br+bi)) = re&te*ect(&rbr - &ibi+ &ibr / bi&r)let m l'i&Pol&r (Pol&r(r1+th1)) (Pol&r(r2+th2)) = re&tePol&r(r1r2+ th1/ th2)
These tags areNacti(e recognier
la$els
These tags areNacti(e recognier
la$els
The *hole functionis an Nacti(erecognier)
The *hole functionis an Nacti(erecognier)
They are Kust or'inafunctions *ith N$ana
names
They are Kust or'inafunctions *ith N$ana
names
The use of acti(erecognier la$els
imlicitly selectan' aly thefunction
The use of acti(erecognier la$els
imlicitly selectan' aly thefunction
(,*ect,)(,Pol&r,)
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 55/88
mo!le &0icP&tter%0 =
let (,'&l e, ,) (e Sh&rp3 pr)
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 56/88
let (,'&le,,) (e:Sh&rp3xpr) = ...
let (,o%0t,,) (e:Sh&rp3xpr) = ...
let (,#$pe4&mb!&,,) (e:Sh&rp3xpr) = ...
let (,4&mb!&,,) (e:Sh&rp3xpr) = ...
let (,5pplic&tio%,,) (e:Sh&rp3xpr) = ...
let (,I6#he%3l0e,,) (e:Sh&rp3xpr) = ...
let (,4et,,) (e:Sh&rp3xpr) = ...
let (,4et*ec,,) (e:Sh&rp3xpr) = ...
let (,7ew*ecor!,,) (e:Sh&rp3xpr) = ...
let (,7ew8%io%&0e,,) (e:Sh&rp3xpr) = ...
let (,7ew#ple,,) (e:Sh&rp3xpr) = ...
let (,#ple9et,,) (e:Sh&rp3xpr) = ...
let (,I!e%ti6ier7&meS$%t&x,,) (%: Sh&rpS$%t&x7o!e) =
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 57/88
m&tch % with , : I!e%ti6ier7&meS$%t&x &0 t -> Some(t.Sh&rp;i%!()+t.I!e%ti6ier) , -> 7o%e
let (,I!e%ti6ier7&me,,) (%: Sh&rpS$%t&x7o!e) = m&tch %.Sh&rp;i%!() with , S$%t&x;i%!.I!e%ti6ier7&me -> ... , -> 7o%e
let (,<&li6ie!7&meS$%t&x,,) (%: Sh&rpS$%t&x7o!e) = m&tch % with , : <&li6ie!7&meS$%t&x &0 t -> ...
, -> 7o%e
let (,<&li6ie!7&me,,) (%: Sh&rpS$%t&x7o!e) = m&tch %.Sh&rp;i%!() with , S$%t&x;i%!.<&li6ie!7&me -> ... , -> 7o%e
Pattern7atching
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 58/88
Relaxation %chie(e' ;
%n extremely useful mechanism that greatly ex
utility of attern matching in the languag
Don<t lea(e home *ithout them
7atching
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 59/88
Co'e Dat1n one large
comany, GS44eole *or+ on
tooling for this
"an' Seole *
tooling f
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 60/88
Ae are li(ing through ainformation re(olution
The 1nformation Re(olution
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 61/88
3 5 S Z [
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 62/88
Ae nee' to $ring information intlanguage"
%t internet-scale, strongl" tooled, strot"ped
Para'igm Locator
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 63/88
Options
• ma/e staticall" t"ped langmore d"namic
• ma/e d"namicall" t"pedlangs more static
• appl" moderated static
t"ping much more broadl"
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 64/88
htt.HHfshar)githu$)ioHFhar)DataHimages
htt.HHfshar)githu$)ioHFhar)DataHimage
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 65/88
Enter . T"pe 0ro%iders12
NWust li+e a li$rary
N% 'esign!time comonent that comutes a sace of
metho's on!'eman'"
N%n a'ator $et*een 'ataHser(ices an' the )ET tye s
NOn!'eman', scala$le comile!time ro(ision of tye'enitions"
Theme # ! 7any Data ources, O7 h i
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 66/88
7echanism
t"pes
egoe 1 Light
IL #
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 67/88
H33HZ Z
IL #3
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 68/88
H33HZ Z
C6
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 69/88
H33HZ Z
WO
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 70/88
H33HZ [
07L
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 71/88
H33HZ [
Va'ooHVi(e
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 72/88
H33HZ [
Ae$ %P1s
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 73/88
H33HZ [
Entity &rahs
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 74/88
H33HZ [
ADL
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 75/88
H33HZ [
R
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 76/88
H33HZ [
Theme #3 ! Data at 7ultile ca
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 77/88
From E(erything to 1n'i(i'uals
d$t$.llnt&te!
Data criters ne*or+ *ith 'ier
granularities schematiatio
d$t$.utomot&ve.utomob&le odel!
d$t$.utomot&ve.utomob&le odel!.-nd&v&du$l!.or!ce /
"Only a language thatsuorts massi(ely scala$lemeta'ata can oerate at all
these le(els
E(ery staentity c
get a untye
“The idea of integrating interne
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 78/88
information services directly i program's ariable and type space is pr
the most innovative programlanguage idea I!e heard of in a de
# Wim Cor'y, Iu
O(erly +in', $ut thought ro
Co'e
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 79/88
Relaxation %chie(e' ; ;
F# Tye Pro(i'ers ha(e $een a hugely successful featurange of useful alication is enormous) They $ring '
tye' rogramming into synthesis li+e no other featur
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 80/88
0 -
?
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 81/88
ync %syn
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 82/88
um$ersum$
*ith
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 83/88
&P CP
htt.HHfshar)orgHuseHgu ;
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 84/88
Ahat<s %hea'
Aell, for me, many areas of tension in Nu
language 'esign ha(e $een resol(e
But there are still some areas that $ug
Distri$
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 85/88
REPLDistri$
n ancal
htt.HHm!$race)net
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 86/88
Ro*s Colum
e)g) Trill ! 6LDB ]S
1n ConclusionFunctional
O$Kects ync
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 87/88
Co'e Data
OenEnterris
e "
7/25/2019 F# Path to Relaxation
http://slidepdf.com/reader/full/f-path-to-relaxation 88/88