js-slang
Version:
Javascript-based implementations of Source, written in Typescript
33 lines • 1.08 kB
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.is_boolean = exports.atomic_not = exports.atomic_and = exports.atomic_or = exports.truthy = void 0;
// 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);
}
exports.truthy = truthy;
function atomic_or(a, b) {
return truthy(a) || truthy(b);
}
exports.atomic_or = atomic_or;
function atomic_and(a, b) {
return truthy(a) && truthy(b);
}
exports.atomic_and = atomic_and;
function atomic_not(a) {
return !truthy(a);
}
exports.atomic_not = atomic_not;
function is_boolean(x) {
return x === true || x === false;
}
exports.is_boolean = is_boolean;
//# sourceMappingURL=core-bool.js.map
;