@dallaylaen/ski-interpreter
    Preparing search index...

    Function toposort

    • Topologically sort a list of terms, extending it with any missing dependency terms, if necessary. The output list is guaranteed to contain at least the input terms.

      Type Parameters

      Parameters

      • options: { allow?: Record<string, Named>; env?: Record<string, Named>; list?: T | T[] }
        • Optionalallow?: Record<string, Named>

          a set of terms that are allowed in the returned list (aside from the input list).

        • Optionalenv?: Record<string, Named>

          a set of terms assumed to be known (and thus not required in the output list).

        • Optionallist?: T | T[]

          a single expression or a list of expressions to sort.

      Returns ToposortResult<T>

      const expr = ski.parse(src);
      toposort([expr], ski.getTerms()); // returns all terms appearing in Expr in correct order