# The goal: π¦ π π

### ... by rethinking anything and everything about programming

``````factorial n = product (range 1 (n+1))
blah      n = product (range 1 (n+1))
blah2     z = product (range 1 (z+1))``````

``#j1ejquc``
``````src/
math.u
list.u``````
``````.unison/
j1ejquc/
ast.ub
names/
factorial
blah
8h7jbs5/
``````
``````factorial n = product (range 1 (n + 1))

factorial =
n -> #8h7jbs5 (#h9bwx9q 1 (#e2i3biw n 1))

factorial =
\$arg1 -> #8h7jbs5 (#h9bwx9q 1 (#e2i3biw \$arg1 1))``````

``````.unison/
j1ejquc/
ast.ub
names/
factorial
blah
8h7jbs5/
``````

# Benefits

## Easy renames

``````.unison/
j1ejquc/
ast.ub
names/
factorial
``````
``````.unison/
j1ejquc/
ast.ub
names/
transmogrify``````

### ... and this breaks no one π¦ π π

``myFactorialTest = expect (factorial 5 == 120)``

## No builds

``````.unison/
j1ejquc/
ast.ub
type.ub
names/factorial
``````

### ... and no one else needs to build it either!! π¦ π π

``myFactorialTest = expect (factorial 5 == 120)``

## Caching test results

``````.unison/
30hbxzj/
ast.ub
type.ub
evaluated.ub
names/myFactorialTest``````

# πββοΈ

``````factorialAt : Node ->{Remote} Nat
factorialAt bob =
r1 = at bob '(factorial 7)
r2 = at spawn '(factorial 8)
force r1 + force r2``````
``````dsort : (a -> a -> Boolean) -> [a] ->{Remote} [a]
dsort lte as =
if size as < 2 then as
else case halve as of (left, right) ->
resL = at spawn '(dsort lte left)
resR = at spawn '(dsort lte right)
merge lte (force resL) (force resR)``````

### Distributed programming as a library

``````ability Remote where
at    : Node -> '{Remote} a -> Future a
force : Future a -> a
spawn : Node``````
``````Remote.runLocal '(dsort hugeDataset)

Cloud.usEast.run '(dsort hugeDataset)``````

## Batch computing (local state only)

``````ability Remote where
at    : Node -> '{Remote} a -> Future a
force : Future a -> a
spawn : Node``````

By Paul Chiusano

# Unison: Strange Loop 2019

Presentation on Unison from Strange Loop 2019

• 2,357