js-slang
Version:
Javascript-based implementations of Source, written in Typescript
32 lines • 970 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.truthy = truthy;
exports.atomic_or = atomic_or;
exports.atomic_and = atomic_and;
exports.atomic_not = atomic_not;
exports.is_boolean = is_boolean;
// this file contains the minimum subset
// required for boolean operations to work.
// important distinction between scheme truthy
// and falsy values and javascript truthy and falsy values.
// in scheme, only #f is false, everything else is true.
function truthy(x) {
return !(x === false);
}
function atomic_or(a, b) {
return truthy(a) || truthy(b);
}
function atomic_and(a, b) {
return truthy(a) && truthy(b);
}
function atomic_not(a) {
return !truthy(a);
}
function is_boolean(x) {
return x === true || x === false;
}
//# sourceMappingURL=core-bool.js.map