Download - Tour of language landscape (katsconf)
![Page 1: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/1.jpg)
tour guide : Yan Cui @theburningmonk
![Page 2: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/2.jpg)
Hi, my name is Yan Cui.
![Page 3: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/3.jpg)
![Page 4: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/4.jpg)
1MILLION USERS
ACTIVEDAILY
![Page 5: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/5.jpg)
250MILLION DAY
PERREQUEST
![Page 6: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/6.jpg)
agenda
![Page 7: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/7.jpg)
Type Provider Pipes
Statically Resolved TP Implicit Interface Implementation
Borrowed Pointers Dependent Types
Uniqueness Types
Bit SyntaxSignals
Macros
Unit-of-Measure
Actor Model
![Page 8: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/8.jpg)
F#ClojureErlang
Go
RustElm Idris
![Page 9: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/9.jpg)
F#ClojureErlang
Go
RustElm Idris
![Page 10: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/10.jpg)
disclaimers
![Page 11: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/11.jpg)
“Programming languages have a devious influence: they shape our thinking
habits.”
- Edsger W. Dijkstra
![Page 12: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/12.jpg)
“One of the most disastrous thing we can learn is the first programming language, even
if it's a good programming language.”
- Alan Kay
![Page 13: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/13.jpg)
“The limits of my language means the limits
of my world.”
- Ludwig Wittgenstein
![Page 14: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/14.jpg)
“We cannot solve our problems with the same thinking we used when
we created them.”
- Albert Einstein
![Page 15: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/15.jpg)
F#ClojureErlang
Go
RustElm Idris
![Page 16: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/16.jpg)
![Page 17: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/17.jpg)
your app
![Page 18: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/18.jpg)
your app
CSVCSVCSV
CSVCSVXML
![Page 19: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/19.jpg)
your app
CSVCSVCSV
CSVCSVXML
some service
![Page 20: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/20.jpg)
your app
CSVCSVCSV
CSVCSVXML
some service
DB
![Page 21: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/21.jpg)
1. define DTO types!2. I/O!3. marshal data into DTO!4. do useful work
![Page 22: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/22.jpg)
1. define DTO types!2. I/O!3. marshal data into DTO!4. do useful work
![Page 23: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/23.jpg)
compilerprovideexternal
data source typed info
![Page 24: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/24.jpg)
type providers
![Page 25: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/25.jpg)
intellisense!tooltips!
…
![Page 26: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/26.jpg)
![Page 27: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/27.jpg)
![Page 28: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/28.jpg)
compile time validation
![Page 29: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/29.jpg)
no code generation
![Page 30: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/30.jpg)
R
FunScript AzureAmazon S3
CSVSQLiteSQL Server
WSDL
WorldBank
RegexODATA IKVM
FacebookApiary
XAMLFreebaseHadoop
Oracle
Minesweeper
Don SymePowershell
JSON
Fizzbuzz
Mixin
RSS
MatlabDates
NorthPole
XML
Python
![Page 31: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/31.jpg)
pipes
![Page 32: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/32.jpg)
“…a clean design is one that supports visual thinking so
people can meet their informational needs with a
minimum of conscious effort.”
- Daniel Higginbotham (www.visualmess.com)
![Page 33: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/33.jpg)
Whilst talking with an ex-colleague, a question came up on how to implement the Stable Marriage problem using a message passing approach. Naturally, I wanted to answer that question with Erlang!!!Let’s first dissect the problem and decide what processes we need and how they need to interact with one another.!!The stable marriage problem is commonly stated as:!Given n men and n women, where each person has ranked all members of the opposite sex with a unique number between 1 and n in order of preference, marry the men and women together such that there are no two people of opposite sex who would both rather have each other than their current partners. If there are no such people, all the marriages are “stable”. (It is assumed that the participants are binary gendered and that marriages are not same-sex).!From the problem description, we can see that we need:!* a module for man!* a module for woman!* a module for orchestrating the experiment!In terms of interaction between the different modules, I imagined something along the lines of…
how we read ENGLISH
see also http://bit.ly/1KN8cd0
![Page 34: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/34.jpg)
Whilst talking with an ex-colleague, a question came up on how to implement the Stable Marriage problem using a message passing approach. Naturally, I wanted to answer that question with Erlang!!!Let’s first dissect the problem and decide what processes we need and how they need to interact with one another.!!The stable marriage problem is commonly stated as:!Given n men and n women, where each person has ranked all members of the opposite sex with a unique number between 1 and n in order of preference, marry the men and women together such that there are no two people of opposite sex who would both rather have each other than their current partners. If there are no such people, all the marriages are “stable”. (It is assumed that the participants are binary gendered and that marriages are not same-sex).!From the problem description, we can see that we need:!* a module for man!* a module for woman!* a module for orchestrating the experiment!In terms of interaction between the different modules, I imagined something along the lines of…
2. top-to-bottom1.left-to-right
how we read ENGLISH
see also http://bit.ly/1KN8cd0
![Page 35: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/35.jpg)
how we read CODE
public void DoSomething(int x, int y)!{! Foo(y,! Bar(x,! Zoo(Monkey())));!}
see also http://bit.ly/1KN8cd0
![Page 36: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/36.jpg)
how we read CODE
public void DoSomething(int x, int y)!{! Foo(y,! Bar(x,! Zoo(Monkey())));!}
2. bottom-to-top
1.right-to-left
see also http://bit.ly/1KN8cd0
![Page 37: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/37.jpg)
Whilst talking with an ex-colleague, a question came up on how to implement the Stable Marriage problem using a message passing approach. Naturally, I wanted to answer that question with Erlang!!!Let’s first dissect the problem and decide what processes we need and how they need to interact with one another.!!The stable marriage problem is commonly stated as:!Given n men and n women, where each person has ranked all members of the opposite sex with a unique number between 1 and n in order of preference, marry the men and women together such that there are no two people of opposite sex who would both rather have each other than their current partners. If there are no such people, all the marriages are “stable”. (It is assumed that the participants are binary gendered and that marriages are not same-sex).!From the problem description, we can see that we need:!* a module for man!* a module for woman!* a module for orchestrating the experiment!In terms of interaction between the different modules, I imagined something along the lines of…
2. top-to-bottom
1.left-to-right
how we read ENGLISH
public void DoSomething(int x, int y)!{! Foo(y,! Bar(x,! Zoo(Monkey())));!}
2. top-to-bottom
1.right-to-left
how we read CODE
see also http://bit.ly/1KN8cd0
![Page 38: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/38.jpg)
“…a clean design is one that supports visual thinking so
people can meet their informational needs with a
minimum of conscious effort.”
![Page 39: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/39.jpg)
|>
![Page 40: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/40.jpg)
how we read CODE
let drawCircle x y radius = radius |> circle |> filled (rgb 150 170 150) |> alpha 0.5 |> move (x, y)
see also http://bit.ly/1KN8cd0
![Page 41: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/41.jpg)
how we read CODE
let drawCircle x y radius = radius |> circle |> filled (rgb 150 170 150) |> alpha 0.5 |> move (x, y)
2. top-to-bottom1.left-to-right
see also http://bit.ly/1KN8cd0
![Page 42: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/42.jpg)
let drawCircle x y radius = circle radius |> filled (rgb 150 170 150) |> alpha 0.5 |> move (x, y)
see also http://bit.ly/1KN8cd0
![Page 43: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/43.jpg)
let drawCircle x y radius = circle radius |> filled (rgb 150 170 150) |> alpha 0.5 |> move (x, y)
see also http://bit.ly/1KN8cd0
![Page 44: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/44.jpg)
let drawCircle x y radius = circle radius |> filled (rgb 150 170 150) |> alpha 0.5 |> move (x, y)
see also http://bit.ly/1KN8cd0
![Page 45: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/45.jpg)
NASA orbiter crashed because one engineer accidentally used miles instead of kilometres
![Page 46: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/46.jpg)
you’re never too smart to make mistakes
![Page 47: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/47.jpg)
unit-of-measure
![Page 48: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/48.jpg)
[<Measure>]!type Pence
e.g.! 42<Pence>!! 153<Pence>!! …
![Page 49: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/49.jpg)
10<Meter> / 2<Second> ! = 5<Meter/Second>!10<Meter> * 2<Second> ! = 20<Meter Second> !10<Meter> + 10<Meter> ! = 20<Meter>!10<Meter> * 10! ! ! = 100<Meter>!10<Meter> * 10<Meter> ! = 100<Meter2>!10<Meter> + 2<Second> ! // error!10<Meter> + 2 ! ! ! // error
![Page 50: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/50.jpg)
10<Meter> / 2<Second> ! = 5<Meter/Second>!10<Meter> * 2<Second> ! = 20<Meter Second> !10<Meter> + 10<Meter> ! = 20<Meter>!10<Meter> * 10! ! ! = 100<Meter>!10<Meter> * 10<Meter> ! = 100<Meter2>!10<Meter> + 2<Second> ! // error!10<Meter> + 2 ! ! ! // error
![Page 51: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/51.jpg)
F#ClojureErlang
Go
RustElm Idris
!?
![Page 52: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/52.jpg)
![Page 53: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/53.jpg)
Duck Typing
If it looks like a duck and quacks like a duck, it's a duck
![Page 54: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/54.jpg)
def say_quack(duck): duck.quack()
![Page 55: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/55.jpg)
def say_quack(duck): duck.quack()
![Page 56: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/56.jpg)
class Duck: def quack(self): print("quack quack!”)
![Page 57: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/57.jpg)
class Duck: def quack(self): print("quack quack!”) !
duck = Duck() say_quack(duck) !
> quack quack!
![Page 58: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/58.jpg)
class Bird: def quack(self): print(“tweet tweet!”)
![Page 59: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/59.jpg)
class Bird: def quack(self): print(“tweet tweet!”) !
bird = Bird() say_quack(bird) !
> tweet tweet!
![Page 60: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/60.jpg)
ConvenienceSafety
![Page 61: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/61.jpg)
what if…
![Page 63: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/63.jpg)
implicit interface!
implementation
![Page 66: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/66.jpg)
type Donald struct { } func (d Donald) Quack() { fmt.Println(“quack quack!”) }
see also http://bit.ly/1ER5zVs
![Page 67: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/67.jpg)
type Bird struct { } func (b Bird) Quack() { fmt.Println(“tweet tweet!”) }
see also http://bit.ly/1ER5zVs
![Page 68: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/68.jpg)
func main() { donald := Donald{} sayQuack(donald) bird := Bird{} sayQuack(bird) }
see also http://bit.ly/1ER5zVs
![Page 69: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/69.jpg)
quack quack!
func main() { donald := Donald{} sayQuack(donald) bird := Bird{} sayQuack(bird) }
![Page 70: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/70.jpg)
tweet tweet!
func main() { donald := Donald{} sayQuack(donald) bird := Bird{} sayQuack(bird) }
![Page 71: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/71.jpg)
type Dog struct { } func (d Dog) Bark() { fmt.Println(“woof woof!”) }
see also http://bit.ly/1ER5zVs
![Page 72: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/72.jpg)
func main() { dog := Dog{} sayQuack(dog) }
main.go:40: cannot use dog (type Dog) as type Duck in argument to sayQuack:!! Dog does not implement Duck (missing Quack method)
see also http://bit.ly/1ER5zVs
![Page 74: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/74.jpg)
system building is also a process of learning
and discovery
see also http://bit.ly/1ER5zVs
![Page 77: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/77.jpg)
F#ClojureErlang
Go
RustElm Idris
!?
![Page 78: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/78.jpg)
![Page 79: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/79.jpg)
Homoiconicity
…homoiconicity is a property of some programming languages in which the program structure is similar to its syntax, and therefore the program’s internal representation can be
inferred by reading the text’s layout…
![Page 80: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/80.jpg)
code is data data is code
![Page 92: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/92.jpg)
quote
(+ 1 2) => 3 (quote (+ 1 2)) => (+ 1 2) ‘(+ 1 2) => (+ 1 2)see also http://bit.ly/1PpIrjS
![Page 94: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/94.jpg)
macros
![Page 95: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/95.jpg)
(defmacro assert-equals [actual expected] ‘(let [actual-val# ~actual] (when-not (= actual-val# ~expected) (throw (AssertionError. (str “FAIL in “ ‘~actual “\n expected: “ ‘~expected “\n actual: “ actual-val#))))))
see also http://bit.ly/1PpIrjS
![Page 96: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/96.jpg)
(assert-equals (inc 1) 2) ; => nil (assert-equals (inc 1) (+ 0 1)) ; => AssertionError FAIL in (inc 1) ; expected: (+ 0 1) ; actual: 2
see also http://bit.ly/1PpIrjS
![Page 97: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/97.jpg)
(assert-equals (inc 1) 2) ; => nil (assert-equals (inc 1) (+ 0 1)) ; => AssertionError FAIL in (inc 1) ; expected: (+ 0 1) ; actual: 2
see also http://bit.ly/1PpIrjS
![Page 98: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/98.jpg)
(assert-equals (inc 1) 2) ; => nil (assert-equals (inc 1) (+ 0 1)) ; => AssertionError FAIL in (inc 1) ; expected: (+ 0 1) ; actual: 2
see also http://bit.ly/1PpIrjS
huh?? where? what? how?
![Page 99: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/99.jpg)
(defmacro assert-equals [actual expected] ‘(let [actual-val# ~actual] (when-not (= actual-val# ~expected) (throw (AssertionError. (str “FAIL in “ ‘~actual “\n expected: “ ‘~expected “\n actual: “ actual-val#))))))
(assert-equals (inc 1) (+ 0 1))
see also http://bit.ly/1PpIrjS
![Page 100: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/100.jpg)
(defmacro assert-equals [actual expected] ‘(let [actual-val# ~actual] (when-not (= actual-val# ~expected) (throw (AssertionError. (str “FAIL in “ ‘~actual “\n expected: “ ‘~expected “\n actual: “ actual-val#))))))
(assert-equals (inc 1) (+ 0 1))
see also http://bit.ly/1PpIrjS
![Page 101: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/101.jpg)
(defmacro assert-equals [actual expected] ‘(let [actual-val# ~actual] (when-not (= actual-val# ~expected) (throw (AssertionError. (str “FAIL in “ ‘~actual “\n expected: “ ‘~expected “\n actual: “ actual-val#))))))
(assert-equals (inc 1) (+ 0 1))
see also http://bit.ly/1PpIrjS
![Page 102: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/102.jpg)
see also http://bit.ly/1PpIrjS
(defmacro assert-equals [actual expected] ‘(let [actual-val# ~actual] (when-not (= actual-val# ~expected) (throw (AssertionError. (str “FAIL in “ ‘~actual “\n expected: “ ‘~expected “\n actual: “ actual-val#))))))
![Page 103: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/103.jpg)
see also http://bit.ly/1PpIrjS
(defmacro assert-equals [actual expected] ‘(let [actual-val# ~actual] (when-not (= actual-val# ~expected) (throw (AssertionError. (str “FAIL in “ ‘~actual “\n expected: “ ‘~expected “\n actual: “ actual-val#))))))
‘(
![Page 105: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/105.jpg)
see also http://bit.ly/1PpIrjS
(macroexpand '(assert-equals (inc 1) (+ 0 1))) ; => ; (let* [actual-value__16087__auto__ (inc 1)] ; (clojure.core/when-not ; (clojure.core/= actual-value__16087__auto__ (+ 0 1)) ; (throw (java.lang.AssertionError. ; (clojure.core/str ; "FAIL in " (quote (inc 1)) ; "\nexpected: " (quote (+ 0 1)) ; "\n actual: " actual-value__16087__auto__)))))
![Page 106: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/106.jpg)
F#ClojureErlang
Go
RustElm Idris
![Page 107: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/107.jpg)
![Page 108: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/108.jpg)
GC is great
![Page 109: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/109.jpg)
runtime cost
![Page 114: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/114.jpg)
fn foo() { // v has ownership of the vector let v = vec![1, 2, 3]; // mutable binding let mut v2 = vec![]; } // vector is deallocated at the // end of scope, // this happens deterministically
see also http://bit.ly/1F6WBVD
![Page 117: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/117.jpg)
// take ownership let v = vec![1, 2, 3]; !// moved ownership to v2 let v2 = v;
see also http://bit.ly/1F6WBVD
![Page 118: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/118.jpg)
// take ownership let v = vec![1, 2, 3]; !// moved ownership to v2 let v2 = v; !println!("v[0] is {}", v[0]); // error: use of moved value: `v` // println!("v[0] is {}", v[0]); // ^
see also http://bit.ly/1F6WBVD
![Page 119: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/119.jpg)
fn take(v : Vec<i32>) { // ownership of vector transferred // to v in this scope }
see also http://bit.ly/1F6WBVD
![Page 120: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/120.jpg)
// take ownership let v = vec![1, 2, 3]; !// moved ownership take(v);
see also http://bit.ly/1F6WBVD
![Page 121: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/121.jpg)
// take ownership let v = vec![1, 2, 3]; !// moved ownership take(v); !println!("v[0] is {}", v[0]); // error: use of moved value: `v` // println!("v[0] is {}", v[0]); // ^
see also http://bit.ly/1F6WBVD
![Page 129: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/129.jpg)
// note we're taking a reference, // &Vec<i32>, instead of Vec<i32> fn take(v : &Vec<i32>) { // no need to deallocate the vector // after we go out of scope here }
see also http://bit.ly/1F6WBVD
![Page 130: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/130.jpg)
// take ownership let v = vec![1, 2, 3]; !// notice we're passing a reference, // &v, instead of v take(&v); // borrow ownership !println!("v[0] is {}", v[0]); // v[0] is 1
see also http://bit.ly/1F6WBVD
![Page 137: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/137.jpg)
fn take(v : &Vec<i32>) { v.push(5); } !let v = vec![]; take(&v); // cannot borrow immutable borrowed // content `*v` as mutable // v.push(5); // ^
see also http://bit.ly/1F6WBVD
![Page 138: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/138.jpg)
fn take(v : &mut Vec<i32>) { v.push(5); } !let mut v = vec![]; take(&mut v); !println!("v[0] is {}", v[0]); // v[0] is 5
see also http://bit.ly/1F6WBVD
![Page 140: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/140.jpg)
see also http://bit.ly/1F6WBVD
Rule 1.!!
the borrower’s scope must not outlast the owner
![Page 141: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/141.jpg)
see also http://bit.ly/1F6WBVD
Rule 2.!!
one of the following, but not both:! 2.1 0 or more refs to a resource! 2.2 exactly 1 mutable ref
![Page 142: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/142.jpg)
see also http://bit.ly/1F6WBVD
data race
There is a ‘data race’ when two or more pointers access the same memory location at the same time, where at least one of them is writing, and
the operations are not synchronised.
![Page 143: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/143.jpg)
see also http://bit.ly/1F6WBVD
data race
a. two or more pointers to the same resource!b. at least one is writing!c. operations are not synchronised
![Page 144: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/144.jpg)
see also http://bit.ly/1F6WBVD
Data Race Conditions!a. two or more pointers to the same resource!b. at least one is writing!c. operations are not synchronised
Borrowing Rules!one of the following, but not both:!
! 2.1 0 or more refs to a resource! ! 2.2 exactly 1 mutable ref
![Page 145: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/145.jpg)
see also http://bit.ly/1F6WBVD
Data Race Conditions!a. two or more pointers to the same resource!b. at least one is writing!c. operations are not synchronised
Borrowing Rules!one of the following, but not both:!
! 2.1 0 or more refs to a resource! ! 2.2 exactly 1 mutable ref
![Page 147: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/147.jpg)
F#ClojureErlang
Go
RustElm Idris
!!!
![Page 148: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/148.jpg)
![Page 149: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/149.jpg)
seen generics?aka parametric polymorphism
![Page 150: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/150.jpg)
List<T>
![Page 151: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/151.jpg)
List<T>List<int> List<Cat>
List<string>
![Page 152: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/152.jpg)
what if…
![Page 153: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/153.jpg)
types that depend on arbitrary values?
![Page 154: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/154.jpg)
Vect n avector of n elements of type a
![Page 155: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/155.jpg)
zipWith : (a -> b -> c) -> Vect n a -> Vect n b -> Vect n c
![Page 156: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/156.jpg)
zipWith f [] [] = [] zipWith f (x :: xs) (y :: ys) = f x y :: zipWith f xs ys
![Page 157: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/157.jpg)
Type Driven Development
![Page 158: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/158.jpg)
making invalid state UNREPRESENTABLE
![Page 160: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/160.jpg)
F#ClojureErlang
Go
RustElm Idris
![Page 161: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/161.jpg)
![Page 162: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/162.jpg)
Functional Reactive Programming
![Page 163: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/163.jpg)
Value over Time
![Page 164: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/164.jpg)
Time
Value
![Page 165: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/165.jpg)
Signals
![Page 166: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/166.jpg)
Move Up
Move Down
![Page 167: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/167.jpg)
private var arrowKeyUp:Bool; private var arrowKeyDown:Bool; !private var platform1:Platform; private var platform2:Platform; private var ball:Ball;
![Page 168: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/168.jpg)
function keyDown(event:KeyboardEvent):Void { if (currentGameState == Paused && event.keyCode == 32) { setGameState(Playing); } else if (event.keyCode == 38) { ! ! arrowKeyUp = true;! }else if (event.keyCode == 40) { ! ! arrowKeyDown = true;! } }
![Page 169: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/169.jpg)
function keyUp(event:KeyboardEvent):Void { if (event.keyCode == 38) { ! ! arrowKeyUp = false;! } else if (event.keyCode == 40) { ! ! arrowKeyDown = false;! } }
![Page 170: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/170.jpg)
function everyFrame(event:Event):Void { if(currentGameState == Playing){ if (arrowKeyUp) { platform1.y -= platformSpeed; } if (arrowKeyDown) { platform1.y += platformSpeed; } if (platform1.y < 5) platform1.y = 5; if (platform1.y > 395) platform1.y = 395; } }
![Page 171: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/171.jpg)
function everyFrame(event:Event):Void { if(currentGameState == Playing){ if (arrowKeyUp) { platform1.y -= platformSpeed; } if (arrowKeyDown) { platform1.y += platformSpeed; } if (platform1.y < 5) !! ! ! platform1.y = 5;!! ! if (platform1.y > 395) !! ! ! platform1.y = 395;! } }
![Page 172: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/172.jpg)
source files
state changes
![Page 173: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/173.jpg)
source files execution
![Page 174: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/174.jpg)
source files execution
![Page 175: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/175.jpg)
mental model
input state new state behaviour
{ x; y } { x; y-speed }
{ x; y } { x; y+speed }
timer { x; y } { x; y } draw platform
… … … …
![Page 176: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/176.jpg)
transformation
let y = f(x)
Imperative Functional
x.f()
mutation
![Page 177: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/177.jpg)
transformations simplify problem
decomposition
![Page 178: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/178.jpg)
Move Up
Move Down
![Page 179: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/179.jpg)
type alias Platform = {x:Int, y:Int} defaultPlatform = {x=5, y=0} !delta = Time.fps 20 input = Signal.sampleOn delta Keyboard.arrows !cap x = max 5 <| min x 395 !p1 : Signal Platform p1 = foldp (\{x, y} s -> {s | y <- cap <| s.y + 5*y}) defaultPlatform input
![Page 180: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/180.jpg)
type alias Platform = {x:Int, y:Int}!defaultPlatform = {x=5, y=0} !delta = Time.fps 20 input = Signal.sampleOn delta Keyboard.arrows !cap x = max 5 <| min x 395 !p1 : Signal Platform p1 = foldp (\{x, y} s -> {s | y <- cap <| s.y + 5*y}) defaultPlatform input
![Page 181: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/181.jpg)
type alias Platform = {x:Int, y:Int} defaultPlatform = {x=5, y=0} !delta = Time.fps 20 input = Signal.sampleOn delta Keyboard.arrows !cap x = max 5 <| min x 395 !p1 : Signal Platform p1 = foldp (\{x, y} s -> {s | y <- cap <| s.y + 5*y}) defaultPlatform input
![Page 182: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/182.jpg)
Keyboard.arrowsUP { x=0, y=1 } DOWN { x=0, y=-1 } LEFT { x=-1, y=0 } RIGHT { x=1, y=0 }
![Page 183: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/183.jpg)
type alias Platform = {x:Int, y:Int} defaultPlatform = {x=5, y=0} !delta = Time.fps 20 input = Signal.sampleOn delta Keyboard.arrows !cap x = max 5 <| min x 395 !p1 : Signal Platform!p1 = foldp (\{x, y} s -> {s | y <- cap <| s.y + 5*y}) defaultPlatform input
![Page 184: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/184.jpg)
type alias Platform = {x:Int, y:Int} defaultPlatform = {x=5, y=0} !delta = Time.fps 20 input = Signal.sampleOn delta Keyboard.arrows !cap x = max 5 <| min x 395 !p1 : Signal Platform p1 = foldp (\{x, y} s -> {s | y <- cap <| s.y + 5*y}) defaultPlatform input
![Page 185: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/185.jpg)
type alias Platform = {x:Int, y:Int} defaultPlatform = {x=5, y=0} !delta = Time.fps 20 input = Signal.sampleOn delta Keyboard.arrows !cap x = max 5 <| min x 395 !p1 : Signal Platform p1 = foldp (\{x, y} s -> {s | y <- cap <| s.y + 5*y}) defaultPlatform input
![Page 186: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/186.jpg)
type alias Platform = {x:Int, y:Int} defaultPlatform = {x=5, y=0} !delta = Time.fps 20 input = Signal.sampleOn delta Keyboard.arrows !cap x = max 5 <| min x 395 !p1 : Signal Platform p1 = foldp (\{x, y} s -> {s | y <- cap <| s.y + 5*y}) defaultPlatform input
![Page 188: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/188.jpg)
“I thought of objects being like biological cells and/or
individual computers on a network, only able to
communicate with messages.”
- Alan Kay
![Page 189: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/189.jpg)
“OOP to me means only messaging, local retention and protection and hiding of state-
process, and extreme late-binding of all things.”
- Alan Kay
![Page 190: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/190.jpg)
![Page 191: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/191.jpg)
F#ClojureErlang
Go
RustElm Idris
!?
![Page 192: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/192.jpg)
actor model
![Page 193: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/193.jpg)
actor
state mailbox
![Page 194: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/194.jpg)
actors share nothing
![Page 195: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/195.jpg)
actor
state mailboxactor
![Page 196: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/196.jpg)
actor
state mailboxactor
![Page 197: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/197.jpg)
processing!storage!
communication
![Page 198: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/198.jpg)
loop (Map) ->! receive! {get, Key, Pid} ->! Pid ! maps:get(Key, Map, not_found),! loop(Map);! {set, Key, Value} ->! loop(maps:put(Key, Value, Map))! end.
![Page 199: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/199.jpg)
loop (Map) ->! receive! {get, Key, Pid} ->! Pid ! maps:get(Key, Map, not_found),! loop(Map);! {set, Key, Value} ->! loop(maps:put(Key, Value, Map))! end.
![Page 200: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/200.jpg)
loop (Map) ->! receive! {get, Key, Pid} ->! Pid ! maps:get(Key, Map, not_found),! loop(Map);! {set, Key, Value} ->! loop(maps:put(Key, Value, Map))! end.
![Page 201: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/201.jpg)
loop (Map) ->! receive! {get, Key, Pid} ->! Pid ! maps:get(Key, Map, not_found),! loop(Map);! {set, Key, Value} ->! loop(maps:put(Key, Value, Map))! end.
![Page 202: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/202.jpg)
client (N, Pid) ->! Pid ! {set, N, N},! Pid ! {get, N, self()},! receive! not_found -> io:format(“~p :-(~n”, [N]);! N -> io:format(“~p :-)~n”, [N]);! _ -> io:format(“~p …~n”, [N])! end.
![Page 203: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/203.jpg)
client (N, Pid) ->! Pid ! {set, N, N},! Pid ! {get, N, self()},! receive! not_found -> io:format(“~p :-(~n”, [N]);! N -> io:format(“~p :-)~n”, [N]);! _ -> io:format(“~p …~n”, [N])! end.
![Page 204: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/204.jpg)
client (N, Pid) ->! Pid ! {set, N, N},! Pid ! {get, N, self()},! receive! not_found -> io:format(“~p :-(~n”, [N]);! N -> io:format(“~p :-)~n”, [N]);! _ -> io:format(“~p …~n”, [N])! end.
![Page 205: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/205.jpg)
start(N) ->! Kvs = spawn(mod, loop, [#{}]),! [spawn(mod, client, [X, Kvs]) ! || X <- lists:seq(1,N)].
![Page 206: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/206.jpg)
![Page 207: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/207.jpg)
actors are cheap
![Page 208: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/208.jpg)
no locks!
![Page 209: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/209.jpg)
need state?!talk to the actor!
![Page 210: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/210.jpg)
location transparency
![Page 211: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/211.jpg)
makes you !THINK !
about !distributed systems
![Page 212: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/212.jpg)
messaging promotes failure thinking
![Page 213: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/213.jpg)
Distributed
Computing
![Page 214: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/214.jpg)
Network is reliable!Latency is zero!
Bandwidth is infinite!Network is secure!
Topology doesn't change!There is one administrator!
Transport cost is zero!The network is homogeneous
8 fallacies of distributed computing
![Page 215: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/215.jpg)
supervise & restart
![Page 216: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/216.jpg)
F#ClojureErlang
Go
RustElm Idris
![Page 219: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/219.jpg)
10,000 hours to reach top of an ultra-
competitive field
see also http://bit.ly/1KN7SLq
![Page 220: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/220.jpg)
![Page 224: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/224.jpg)
1.Deconstruct the skill!2.Learn enough to self-correct
see also http://bit.ly/1KN7SLq
![Page 225: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/225.jpg)
1.Deconstruct the skill!2.Learn enough to self-correct!3.Remove practice barriers
see also http://bit.ly/1KN7SLq
![Page 226: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/226.jpg)
1.Deconstruct the skill!2.Learn enough to self-correct!3.Remove practice barriers!4.Practice at least 20 hrs
see also http://bit.ly/1KN7SLq
![Page 227: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/227.jpg)
![Page 229: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/229.jpg)
logic programming
![Page 230: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/230.jpg)
stack-oriented programming
![Page 231: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/231.jpg)
array programming
![Page 232: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/232.jpg)
“A language that doesn't affect the way you think
about programming, is not worth knowing.”
- Alan Perlis
![Page 235: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/235.jpg)
“Learning is an act of creation itself, because something happens in you that wasn't
there before.”
- Alan Kay
![Page 236: Tour of language landscape (katsconf)](https://reader036.vdocuments.site/reader036/viewer/2022081323/587f25711a28ab350c8b7b57/html5/thumbnails/236.jpg)
@theburningmonktheburningmonk.comgithub.com/theburningmonk