Fork me on GitHub
Timur Latypoff07:01:37

Is there a simple way to know, on which vars a specific parsed form depends? Say, “if these vars existed, this form would run”.


@timur058 Can you give an example?

Timur Latypoff10:01:06

For example, if I wanted to make something like, but for Clojure by using sci. In Observable, you have live notebooks made of several snippets of code. These snippets may depend on each other (one of them declares x and another one uses it in calculation), but don’t have to be in some particular order. Observable internally resolves the dependencies of snippets and executed them internally in “correct” order. Also, if x changes, it re-runs all snippets that depend on it or depend on dependent snippets. I wonder if sci has an API that would say: “this form you provided depends on these vars being present in context (that are currently missing)”. This way, one could build a dependency tree of how snippets depend on each other, and execute them in “correct” order.


Usually this is done through namespaces and requires

Sam Ritchie12:01:51

@timur058 I’m not sure either but I see what you want and agree that it’s important. If you had this, you could pre-evaluate all of the cells in the notebook

Sam Ritchie12:01:58

in proper order when it’s loaded

Sam Ritchie12:01:11

(as you say in the comment, duh 🙂 )

Sam Ritchie12:01:18

looks like a problem we need to solve!


@U017QJZ9M7W Is this something sci should solve or is this some topological sort problem that should be solved in a sci-using app? And why not use namespaces for this? The namespace system already solves this problem

Sam Ritchie12:01:49

@U04V15CAJ my guess is that what @timur058 wants to enable is the ability to define “cells” of some notebook out of order, and as long as everything COULD be sorted, then great. I don’t think it’s an sci-level problem since this would have to happen before feeding the forms into sci


if you use namespaces like:

(ns cell5 (:require [cell1]))
this would work, and you could artificially prepend these namespace things in front of the expressions

❤️ 1
Sam Ritchie13:01:39

brilliant, I like it


Does this have to do with allow/deny settings?