aboutsummaryrefslogtreecommitdiff
path: root/guide.md
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-21 08:18:40 +0000
committerAleksey Kladov <[email protected]>2019-01-21 08:27:01 +0000
commit5a4276b1af292b940320e64225f04d97d3dd403b (patch)
treea9204218b4b0b4580e10a8a117670aafddcab494 /guide.md
parent9b0aa786ee445b7aafb0942c017ded599aecd955 (diff)
add illustrations
Diffstat (limited to 'guide.md')
-rw-r--r--guide.md15
1 files changed, 12 insertions, 3 deletions
diff --git a/guide.md b/guide.md
index 621a76046..abbe4c154 100644
--- a/guide.md
+++ b/guide.md
@@ -227,8 +227,8 @@ of type `V`. Queries come in two basic varieties:
227 227
228 228
229For further discussion, its important to understand one bit of "fairly 229For further discussion, its important to understand one bit of "fairly
230intelligently". Suppose we have two functions, `f1` and `f2`, and one input, `z`. 230intelligently". Suppose we have two functions, `f1` and `f2`, and one input,
231We call `f1(X)` which in turn calls `f2(Y)` which inspects `i(Z)`. `i(Z)` 231`z`. We call `f1(X)` which in turn calls `f2(Y)` which inspects `i(Z)`. `i(Z)`
232returns some value `V1`, `f2` uses that and returns `R1`, `f1` uses that and 232returns some value `V1`, `f2` uses that and returns `R1`, `f1` uses that and
233returns `O`. Now, let's change `i` at `Z` to `V2` from `V1` and try to compute 233returns `O`. Now, let's change `i` at `Z` to `V2` from `V1` and try to compute
234`f1(X)` again. Because `f1(X)` (transitively) depends on `i(Z)`, we can't just 234`f1(X)` again. Because `f1(X)` (transitively) depends on `i(Z)`, we can't just
@@ -236,7 +236,16 @@ reuse its value as is. However, if `f2(Y)` is *still* equal to `R1` (despite
236`i`'s change), we, in fact, *can* reuse `O` as result of `f1(X)`. And that's how 236`i`'s change), we, in fact, *can* reuse `O` as result of `f1(X)`. And that's how
237salsa works: it recomputes results in *reverse* order, starting from inputs and 237salsa works: it recomputes results in *reverse* order, starting from inputs and
238progressing towards outputs, stopping as soon as it sees an intermediate value 238progressing towards outputs, stopping as soon as it sees an intermediate value
239that hasn't changed. 239that hasn't changed. If this sounds confusing to you, don't worry: it is
240confusing. This illustration by @killercup might help:
241
242<img alt="step 1" src="https://user-images.githubusercontent.com/1711539/51460907-c5484780-1d6d-11e9-9cd2-d6f62bd746e0.png" width="50%">
243
244<img alt="step 2" src="https://user-images.githubusercontent.com/1711539/51460915-c9746500-1d6d-11e9-9a77-27d33a0c51b5.png" width="50%">
245
246<img alt="step 3" src="https://user-images.githubusercontent.com/1711539/51460920-cda08280-1d6d-11e9-8d96-a782aa57a4d4.png" width="50%">
247
248<img alt="step 4" src="https://user-images.githubusercontent.com/1711539/51460927-d1340980-1d6d-11e9-851e-13c149d5c406.png" width="50%">
240 249
241## Salsa Input Queries 250## Salsa Input Queries
242 251