js-slang
Version:
Javascript-based implementations of Source, written in Typescript
19 lines • 788 B
JavaScript
// we need this file for now, because the lazy variants
// of Source cannot handle ... yet
Object.defineProperty(exports, "__esModule", { value: true });
exports.stream = void 0;
const list_1 = require("./list");
// stream makes a stream out of its arguments
// LOW-LEVEL FUNCTION, NOT SOURCE
// Lazy? No: In this implementation, we generate first a
// complete list, and then a stream using list_to_stream
function stream(...elements) {
return list_to_stream((0, list_1.list)(...elements));
}
exports.stream = stream;
// same as list_to_stream in stream.prelude.ts
function list_to_stream(xs) {
return (0, list_1.is_null)(xs) ? null : (0, list_1.pair)((0, list_1.head)(xs), () => list_to_stream((0, list_1.tail)(xs)));
}
//# sourceMappingURL=stream.js.map
;