►
From YouTube: How Salsa Works (2019.01)
Description
The Dropbox Paper has been converted to a gist here:
https://gist.github.com/nikomatsakis/0bd497f157a40776216f37d8bbec25cd
Or, if you prefer, you can view the original document here (but it will record your e-mail, I believe):
https://paper.dropbox.com/doc/How-Salsa-Works-2019.01--AWnkDrrWoSyv0yfTleFeyGElAg-u8rQGbebYIxSA8r23muiN
A
So
let's
start
with
the
first
question:
what
is
salsa
anyway,
it's
also
the
libraries
for
incremental
recomputation
and
what
I
mean
by
that
is
basically
imagine
you
have
some
function
like
we'll
call
it
through
various,
and
it
has
that's
like
two
inputs
and
it
produces
an
output,
these
types
they
might
be,
and
then
the
idea
is
well
in
some
part
of
your
code.
You
invoke
this
function
with
one
input
and
then
later
you
invoke
it
again,
but
with
slightly
different
set
of
inputs
and
ei.
Is
this
thing
the
PS
change?
A
We
would
like
to
make
this
more
efficient,
we'd
like
to
reuse
some
of
the
intermediate
values
that
you
did
right
in
the
first
of
all
and
that's
the
basic
idea
of
salsa
is
how
to
make
this
kind
of
automatic,
and
what
I
mean
by
that
is.
You
will
reuse
automatically
I,
don't
necessarily
mean
that
you'll
get
really
good
news.
That
requires
really
fishy
to
me,
but
we
will
be
use
automatically
and
sound
or
correct.
A
By
that
I
mean
you
get
the
same
result
essentially
as
if
we
didn't
do
any,
who
used
at
all
how's
that
so
cool,
that's
what
sells
there
is.
No,
so
salsas
actual
model
doesn't
isn't
like
a
random
function
like
through
it's
actually
some
easting
and
all
much
more
complicated
cases.
Right
so
imagine
you
have
like
an
IDE.
A
In
that
case,
you
might
have
the
inputs
might
be
something
like
a
manifest.
You
can
think
of
my
card
with
optimal
file.
The
data
inside
that
may
be
as
well
as
the
sources
the
source
files
in
their
text
right
will
not
be
like.
Okay,
food
LRS
has
contents
food
on
our
essence
and
the
outputs.
Well
there's
a
lot
of
possible
outputs,
but
one
might
be
the
actual
like
binary
executable
between
Mantovani,
but
you
might
also
have
things
like
what
are
the
completions
at
this
point
or
what
is
the
type
or
what?
A
So,
let's
give
it
a
kind
of
high
level
idea.
So
how
does
it
work?
Is
that
kind
of
high
level
view
from
house
also
works
well
you're
going
to
identify,
but
the
first
thing
is
you:
have
you
have
to
identify
for
yourself
those
inputs
and
outputs
that
you
want
right
and
when
we
well,
rather,
you
identify
the
inputs
later,
like
that,
it's
probably
the
base
inputs
to
your
computation,
and
the
main
thing
here
is
that
they
are
not
something
which
you
compute.
There
are
something
that
you
kind
of
gets
at
from
the
outside.
A
You
get
given
them,
and
then
you
have
these
things
with
a
kind
of
derived
values
and
derived
values
are
basically
some
deterministic
you're
gonna
give
a
deterministic
and
a
pure
function
from
the
from
the
inputs
to
that
computes
them
right
and
this
this
function
will
take
we'll
start
with
some
of
the
inputs
and
produce
the
outputs.
So
these
divided
values
they
might
be.
You
know
at
the
very
limit
they'll,
be
things
like
what
are
the
completions
at
this
point,
but
there
might
be
intermediate
steps,
though.
A
The
manifest
here
is
like
think
of
these,
like
a
label,
and
maybe
some
some
inputs
right,
so
the
source
fax
might
be
like
kind
of
giving
the
source
text
for
some
path,
X
and
the
manifest
just
to
keep
it
simple.
Maybe
the
manifest
actually
gives
you
back
like
a
vector
of
of
paths
and
the
source
text
would
be
like
path.
X,
I
look
give
you
back
a
string.
That's
they
that's
kind
of
how
these
are
gonna.
Look
for
me
when
she
get
to
meet
with
us.
A
So
our
ast
might
be
something
like
X
the
same
path
and
it's
going
to
give
us
an
ast
whatever
that
is,
and
so
an
ast
is
not
like
a
final
output.
That's
the
meaning!
It's
an
intermediate
value
that
we
could
use
right
to
do
our
computation
and
eventually,
we'll
have
something
like
the
completion
at
line
number
and.
A
We're
gonna
see
that
it's
going
to
compute
variants
derived
values
as
if
those
intermediate
values
and
eventually
read
from
the
inputs
to
produce
the
result,
and
also
the
framework
is
going
to
track,
but
in
the
course
of
computing
say
the
ast
for
a
given
path
will
track,
which
inputs
did
we
access,
which
derived
values
and
we'll
use
that
later,
to
figure
out
what
should
happen
when
the
inputs
change
right.
So
when
an
input
changes,
you
can
say
these
values,
these
derived
values
are
still
valid
because
the
inputs
that
they
touch
changed.
A
Well,
maybe
these
drive
values
may
be
invalid
because
some
of
their
inputs
change
and
we'll
see
that
actually
we're
a
little
bit
smarter
than
this
might
suggest.
So
it
doesn't
just
figure
out
everything,
that's
sort
of
downstream
from
a
change.
What
does
that
would
usually
be
quite
a
lot
of
your
computation?
We
can
actually
do
somewhat
better
than
that.
No,
but,
but
basically
that
the
model
you
should
I
think
mono
useful
to
have
in
your
head
is
there's
the
kind
of
graph,
so
we
might
have.
We
have
our
inputs
on
one
side
right.
A
So
let's
say
something
like
this
and
then
these
are.
These
are
like.
We
call
these
queries.
These
even
know
it's
in
the
back
and
then
when
you
have
a
derived
query,
so
something
like
AST
edges
this
way,
these
become
also
nodes
in
there.
So
what
we're
saying
here
is
when
I'm
computing,
the
ast
for
a
given
path.
I
need
to
know
the
I
have
to
use
the
source
text
to
do
it
and
then
on
both
the
parser
I
may
be
computing.
The
ast
is
just
running
the
parser
on
one
file.
A
It
doesn't
need
any
other
input
than
the
source
tags,
but
when,
but
how
do
we
know
so
the
whole?
This
is
all
in
the
context
of
some
compilation
like
so
somewhere.
There'll
be
some
sort
of
some
root
thing
that
we're
trying
to
do,
and
this
is
kind
of
that
function.
Foo
I
was
button
in
this
compilation.
A
Maybe
this
is
going
to
read
from
the
manifest
to
start,
and
it's
also
going
to
read
like
you
know,
from
each
of
these
once
it
reads
from
the
manifest
it's
going
to
go
access
we
are
gonna,
go
read
the
ast
es
of
all
the
inputs
right
and
so
forth.
Actually,
personally,
a
lot
of
other
values
between
these
two
is
to
say
that
the
role
compilation
is
just
a
purse.
Maybe
we
can
rename
this
to
them.
First
everything.
A
So
now
we
have
kind
of
our
base
inputs,
the
manifests
the
source
text,
so
I
stack.
These
are
our
basic
words.
We
have
some
intermediate
derived
values,
and
then
we
have
this
goal
here:
parse
everything,
but
maybe
we'll
call
it
whole
program
ast.
This
was
fun
and
we'll
say
the
whole
program
has
to
do
all
the
assets
for
each
file
compacted
and
in
order
to
conclude
that
we
had
to
access
the
name
Fest,
we
had
to
access
the
SD
for
each
individual
file
and
then
we
gave
out
of
the
salt.
A
Well,
maybe
this
winds
up
being
computed
part
I
was
like
typing
or
something.
Actually,
this
wouldn't
be
a
very
good
structure,
and
so
now
what?
If
we
have
this
graph?
If
we
see
a
change
like
the
source
x,
then
we
can
easily
see
okay,
if
you
change
a
dot
RS,
that's
going
to
potentially
affect
the
ISTE
that
will
in
turn,
potentially
affect
the
whole
program,
which
would
mean
type
checking.
All
these
results
are
invalidated,
but
the
AAS
teams
from
the
other
files,
they're
just
fun
and
one
of
the
magic.
A
Is
actually
stop
with
propagation
a
little
bit
early
in
something?
So
imagine
that
although
we
see
that,
like
this
roll
path
is
potentially
effective,
this
will
pass
here.
We
might
also
see
that
after
me
run
the
part,
so
you
end
up
with
the
same
ASD.
We
got
the
time
before
and
so
maybe
all
they
did
was
add
some
spaces
and
that
doesn't
affect
the
ASD.
But
then
all
those
sorts
of
extremes,
the
ast
scale,
is
C.
A
A
This
is
a
derived
where
both
of
these
queries
have
a
query.
Basically,
some
value
that
we
access
in
the
course
about
maybe
something
you
compute
for
a
drive-through
or
something
we
didn't
agree
and
queries
in
general
have
some
number
of
keys
both
of
these
have
zero
keys,
but
something
like
sois
text
that
had
one
that
had
one
gene,
which
was
the
path
and
all
queries
right,
initially
have
a
result
site
right,
so
they're
kind
of
a
function.
So
this
would
be
like
a
manifest.
This
might
be
a
st
source
text.
A
I
think
you
said
it's
a
string
and
yes,
that's
just
for
completeness,
we'll
throw
in
a
sta
also
the
AST.
These
are
either
drive
phrases,
one
input
and
one
output.
You
always
have
one
output,
you
can
have
any
number
of
engines,
and
so
you
don't
have
any
good
examples
here,
but
you
can
have
a
query.
That's
like
that
takes
two
integers,
and
now
it
kind
of
has
two
keys
or
you
can
think
of.
It
is
yes,
one
tuple
as
the
key
and
the
output
here,
let's
say
after
we
do.
A
A
The
only
thing
is
just
like
you
don't
build
your
whole
program
in
one
giant
file
or
function.
You
don't
build
your
database
and
of
all
at
once,
but
it's
gonna
have
to
currently
has
all
the
internal.
It
has
to
know
all
the
queries
that
you
do,
but
you
don't
have
to
miss
them
sort
of
all
in
one
place.
A
Instead,
what
we
do
must
be
group
queries
what
I'm
calling
query
groups
they're
kind
of
like
salsa,
modulus
they're,
basically
a
set
of
queries
which
which
are
defined
together
as
a
unit,
and
then
you
combine
very
groups
before
you.
Do
this
welcome
back
to
tricks,
but
I
want
to
just
point
out
Monday's
in
the
way
you're
going
to
interact
and
salsa.
When
you
have
these
queries,
the
database
basically
feels
like
a
function
of
the
business.
So,
for
example,
if
I
have
a
database
and
I
invoke,
TB
doesn't
manifest.
A
I
got
a
manifest
return
to
write
and
then
the
idea
is
or
if
I
broke,
your
DBA
s2,
something
then
I'm
gonna
get
the
ast
returned
to
me
for
a
food
RS
and
the
idea
of
incremental
recomputation
is
that
these
values
are
memorized.
If
I
invoke
this
place,
I
just
get
the
result.
Cloned
cannot
be
computed,
at
least
by
default.
A
The
idea
is
even
once
the
inputs
change.
I
may
just
hope.
This
is
a
result.
It
did
not
was
not
affected
by
the
change.
Didn't
work.
I
can
just
get
it
cloned,
they
don't
have
to
so
how
do
inputs
change?
Well,
unlike
when
you
have
an
input
query,
you
also
have
a
method,
a
set
method
that
you
can
use
where
you
kind
of
say:
okay,
I'm
gonna
set
set
the
value
of
this
input,
and
this
triggers
other
memorized
or
previous
memorized
values.
A
Whose
needs
okay,
so
let's
come
back
to
three
keys,
so
we
saw
now
how
you're
actually
going
to
use
the
database,
but
how
are
we
going
to
define
the
database
do
that
using
prayer
groups?
The
idea
would
be,
let's
use
an
example,
we'll
go
back
to
our
off
to
our
IDE
query,
sir.
You
might
want
to
have,
for
example,
a
prayer
group
that
is
basically
the
for
inputs
will,
despite
evils
that
I've
identified,
and
to
do
that.
We
just
basically
write
a
trade.
A
Actually
that
growth
was
very
good
once
again,
this
meaning
second,
and
what
this
will
do
is
it
will
it
will
kind
of
a
decorator
or
I?
Can
you
network
it
will
process
this
tree?
It
will
produce
that
tree
as
output,
but
it
will
also
produce
a
bunch
of
intermediate
stuff.
That's
also
uses,
and
one
of
those
things
is
something
called.
A
The
storage
struck,
the
name
of
which
is
given
here,
and
this
will
see
later
we're
going
to
use
that
later,
when
we
create
the
database
to
put
all
the
pretty
girls
together
and
so
that,
basically,
the
set
of
queries
and
we
reboot
are
just
a
set
of
methods
in
the
street.
All
the
methods
have
been
done
before
and
much
like
this
one
cell,
and
you
can
mark
them
with
special
attributes,
like
salsa,
employed
to
indicate
that,
in
this
case
were
saying,
these
are
the
base
inputs.
A
A
A
Okay,
but
I
would
define
this
ast
query
and
if
you
recall,
I
showed
you
before
the
ast
query
is
gonna
wind
up
when
it
executes
that
it's
given
the
names
of
the
past
apart,
so
it
needs
to
get
the
source
text
for
that
in
order
to
parse
it.
So
you
can
make
one
query:
you
have
access
to
another,
just
like
we
being
traits
important
here.
I
had
a
trait
inputs
and
now
I
say
well.
The
trade
parser
extends
inputs,
and
this
query
ast
is
not
in
English
ready
to
derive
3.
A
A
Sort
of
it's
just
ordinary
code,
but
so
this
is
the
function
that
when
we
do
need
to
ask
you
for
a
file,
we're
gonna
call
this
function
and
we're
going
to
give
it
the
database.
Now
we
don't
know
all
the
query
groups
that
are
part
of
this
database,
so
what
we
get
is
actually
some
unknown
type
infiltrate
to
kind
of
say.
Well.
This
is
some
database
that
implements
the
price
rate
because
it
implements
the
parson
trait.
We
know
it
has
an
ast
query.
A
A
A
A
That
you
here
would
be
we
iterate
from
the
manifest
we
create.
We
get
a
get
each
source
file.
We
get
the
est
of
the
source
file
by
invoking
the
ast
query,
which
we'll
call
this
code,
and
then
we
want
to
put
that
into
this
master.
He
has
to
be
the
female,
and
this
is
the
whole
protein.
That's.
This
is
kind
of
how
you
define
movie
plays.
There
are
ways
to
take
these
functions
if
you
don't
want
them
to
be
in
the
same
module
the
traders
to
find
inside,
but
now.
A
A
This
returns
a
vector
of
errors,
that's
the
basic
idea.
Now,
when
you're
all
done
with
this,
eventually,
you
do
have
to
define.
So
this
is
how
you
define
all
the
little
modules.
So
then
you
have
to
put
them
all
together
to
meet
your
final
thickness
and
the
way
that
looks
is
that
you
make
a
start,
and
in
that
struct
you
annotate
it
with
stuffing.
Is
this
invokes
another
grade
and
what
you're
gonna
list
here?
A
This
query
takes
as
input
all
the
storage
for
each
very
good,
so
for
every
crater
that
you
to
put
into
this
business,
you
have
to
have
it
smooth,
and
so
you
put
them
here
and
you
have
thousands
one
field,
which
is
this
also
run
time
and
you
have
to
implement
it's
also
a
long
time.
I'm.
Sorry,
it's
also
database
treat
for
your
database
types
well,
it
might
be
the
bids.
A
And
implementing
the
straight
is
actually
during
Paul
has
been
far
in
terms
of
nine
different
methods
is
a
single,
simple
method
which
returns
to
this.
Basically,
how
the
so
what
happens
here
is
inside
this
one
time
we're
going
to
generate
the
storage
for
all
of
these
query
groups
internally
in
the
engine
and
your
you
own,
that
storage
in
the
end,
and
you
have
to
be
able
to
give
us
a
call,
there's
nothing
and
that's
how
you
defined
your
database.
A
Usually
what
I
do
personally
is
I
also
do
by
default,
so
that
then
you
might
have
a
program
which
says
like,
but
if
me
is
my
database
invoked
VD
dot
set
manifest
blah
blah
blah.
You
got
set
device,
so
you
kind
of
setup
your
inputs
and
now
I
could
invoke
this
fight.
Chuck,
Berry,
alright
and
then
I
could
have
a
little
loop.
That
would
like
perhaps
apply
some
edits
and
mean
both
type
check
a
few
times
and
each
time
we're
going
to
reuse.
Whatever
results
you
can.
A
From
the
previous
execution
ability,
okay,
so
that's
the
basic
overview.
Awesome
thanks
for
listening,
I
would
say
if
you
want
to
learn
more
possible
I
doing
some
other
overviews,
but
also
you
can
complete
the
look.
Here's
where
this
also
RS
salsa,
there's
some
stuff,
there's
some
instructions
and,
in
particular,
there's
the
kind
of
shows
all
the
things
I
talked
about.
But
in
someone
looking
to
all
the
comments
and
tweets
that
IO
very
much.