UNPKG

@harmoniclabs/plu-ts-onchain

Version:

An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript

29 lines (28 loc) 936 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.precursive = void 0; var addUtilityForType_1 = require("../std/UtilityTerms/addUtilityForType.js"); var minimal_1 = require("./minimal.js"); /** * for reference the "Z combinator in js": https://medium.com/swlh/y-and-z-combinators-in-javascript-lambda-calculus-with-real-code-31f25be934ec * * ```js * const Zcombinator = ( * Z => ( * toMakeRecursive => Z( value => toMakeRecursive(toMakeRecursive)(value) ) * )( toMakeRecursive => Z( value => toMakeRecursive(toMakeRecursive)(value)) ) * ); * ``` * of type * ```js * Z => toMakeRecursive => value => result * ``` * and ```toMakeRecursive``` has to be of type * ```js * self => value => result * ``` */ function precursive(fnBody) { return (0, addUtilityForType_1.addUtilityForType)(fnBody.type[2])((0, minimal_1._precursive)(fnBody)); } exports.precursive = precursive;