https://github.com/junosuarez/ski
node module: eponymous functions from the SKI calculus
https://github.com/junosuarez/ski
Last synced: 11 months ago
JSON representation
node module: eponymous functions from the SKI calculus
- Host: GitHub
- URL: https://github.com/junosuarez/ski
- Owner: junosuarez
- License: other
- Created: 2013-02-08T19:47:14.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2015-12-02T16:40:35.000Z (over 10 years ago)
- Last Synced: 2025-09-01T12:24:58.829Z (11 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ski
eponymous functions from the SKI calculus
## installation
$ npm install ski
## usage
var ski = require(ski)
var S = ski.S
var K = ski.K
var I = ski.I
var log = console.log.bind(console)
var tenner = S(K, log, 10)
// 10 logged to console
// tenner === 10
var truth = ski.K(true)
truth()
// => true
ski.I(5)
// => 5
The module is also split into files, so you can use commonjs path syntax to only load the function(s) you need:
var S = require('ski/s')
var K = require('ski/k')
var I = require('ski/i')
## api
descriptions adapted from wikipedia:
### `I = function (x)`, the identify function
I returns its argument:
I(x) => x
### `K = function (x)`, the constant function
K, when applied to any argument x, yields a one-argument constant function Kx , which, when applied to any argument, returns x:
K(x) => (y) => x
### `S = function (x, y, z)`, the substitution function
S is a substitution operator. It takes three arguments and then returns the first argument applied to the third, which is then applied to the result of the second argument applied to the third. More clearly:
S(x, y, z) === x(z)(y(z))
## license
[CC 0](http://creativecommons.org/publicdomain/zero/1.0/) (public domain)