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

    Class Quest

    A combinator problem with a set of test cases for the proposed solution.

    const quest = new Quest({
    input: 'identity',
    cases: [
    ['identity x', 'x'],
    ],
    allow: 'SK',
    intro: 'Find a combinator that behaves like the identity function.',
    });
    quest.check('S K K'); // { pass: true, details: [...], ... }
    quest.check('K S'); // { pass: false, details: [...], ... }
    quest.check('K x'); // fail! internal variable x is not equal to free variable x,
    // despite having the same name.
    quest.check('I'); // fail! I not in the allowed list.
    Index

    Constructors

    Properties

    cases: Case[]
    created?: Date
    engine: Parser
    engineFull: Parser
    env: { [key: string]: Expr }
    envFull: { [key: string]: Expr }
    id?: string | number
    input: (InputSpec & { placeholder: FreeVar })[]
    intro?: string
    meta?: Record<string, unknown>
    name?: string
    restrict: { allow?: string; lambdas?: boolean; numbers?: boolean }

    Methods

    • Display allowed terms based on what engine thinks of this.env + this.restrict.allow

      Returns string

    • Statefully parse a list of strings into expressions or fancy aliases thereof.

      Parameters

      • ...input: string[]

      Returns { prepared: (FreeVar | Alias)[]; weight: number }

    • Parameters

      • options: { date?: boolean } = {}

      Returns { [key: string]: unknown }