From 5a4276b1af292b940320e64225f04d97d3dd403b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 21 Jan 2019 11:18:40 +0300 Subject: add illustrations --- guide.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'guide.md') 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: For further discussion, its important to understand one bit of "fairly -intelligently". Suppose we have two functions, `f1` and `f2`, and one input, `z`. -We call `f1(X)` which in turn calls `f2(Y)` which inspects `i(Z)`. `i(Z)` +intelligently". Suppose we have two functions, `f1` and `f2`, and one input, +`z`. We call `f1(X)` which in turn calls `f2(Y)` which inspects `i(Z)`. `i(Z)` returns some value `V1`, `f2` uses that and returns `R1`, `f1` uses that and returns `O`. Now, let's change `i` at `Z` to `V2` from `V1` and try to compute `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 `i`'s change), we, in fact, *can* reuse `O` as result of `f1(X)`. And that's how salsa works: it recomputes results in *reverse* order, starting from inputs and progressing towards outputs, stopping as soon as it sees an intermediate value -that hasn't changed. +that hasn't changed. If this sounds confusing to you, don't worry: it is +confusing. This illustration by @killercup might help: + +step 1 + +step 2 + +step 3 + +step 4 ## Salsa Input Queries -- cgit v1.2.3