Skip to content

assert.equal erroneously assumes partially applied terms to be LC numerals #89

Closed
@Voileexperiments

Description

@Voileexperiments

repro:

f = \ z _. z
import { assert, LC, getSolution } from "./lc-test.js";

LC.configure({ purity: "Let", numEncoding: "Church", verbosity: "Concise" });
const { f } = LC.compile(getSolution());

describe("Multiply", () => {
  it("example tests", () => {
    assert.equal( f("test"), "test" );
  });
});

This gives

toInt: function result(arg) {
      let argEnv;
      if ( arg?.term && arg?.env ) ({ term: arg, env: argEnv } = arg); // if callback is passed another callback, or a term
      const termVal = new Tuple( typeof arg === 'number' ? fromInt(arg) : arg , new Env(argEnv) );
      if ( term.name==="_" )
        return runEval( new Tuple(term.body, new Env(env)), stack );
      else
        return runEval( new Tuple(term.body, new Env(env).setThunk(term.name, termVal)), stack );
    } is not a number in numEncoding Church

Another reason to not automatically assume LC terms to be integers and convert them.

Also, isn't assert.equal supposed to keep the arguments intact?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions