"Recompute with...", or: a way to "climb the ladder of abstraction"

There was some related discussion in this thread. One thought I’ve had since then is that you can do something along these lines via the notebook imports.

Suppose you have a notebook named myNotebook containing this cell:

cell = {
  // some code depending on cells input1, input2
}

Now, share myNotebook and take note of its version number N.

You can now write:

import {cell as cellCopy} with {newInput1 as input1, newInput2 as input2} from `myNotebook@N`

(Without pinning the version, the notebook will fail to work…)

See this little notebook for this idea in action:

It should be possible to generalize this to more complicated dependency chains (though I agree with the posters in the above-linked thread that having this sort of thing more “built-in” would be cool to see…)

2 Likes