js-slang
Version:
Javascript-based implementations of Source, written in Typescript
24 lines • 737 B
JavaScript
// The core library of scm-slang,
// different from the base library,
// this library contains all methods required
// for the language to function properly.
Object.defineProperty(exports, "__esModule", { value: true });
exports.vector$45$$62$list = exports.pair = void 0;
function pair(car, cdr) {
const val = [car, cdr];
val.pair = true;
return val;
}
exports.pair = pair;
// converts a vector to a list.
// needed because of the way rest parameters
// are handled in javascript.
function vector$45$$62$list(v) {
if (v.length === 0) {
return null;
}
return pair(v[0], vector$45$$62$list(v.slice(1)));
}
exports.vector$45$$62$list = vector$45$$62$list;
//# sourceMappingURL=core-list.js.map
;