Idorobots / spartan

A small Lisp dialect that serves me as a test bed for programming language features.
MIT License
13 stars 3 forks source link

Move continuation argument to the second position after CPS. #177

Open Idorobots opened 8 months ago

Idorobots commented 8 months ago

This will make it easier to leverage vararg function facilities of the target languages such as JS:

const __list = (env, ...args) => {
  const cont = args.last();
  const vals = args.slice(1, args.length() - 1);

  // ... Do something with cont(vals).
}

versus:

const __list = (env, cont, ...vals) => {
  // ... Do something with cont(vals).
}

It also simplifies some of the CPS code.