initial commit

This commit is contained in:
Giles Bradshaw 2020-07-29 14:53:46 +01:00
parent 3a4389f772
commit fe42a75907
2 changed files with 39 additions and 0 deletions

19
compose.libsonnet Normal file
View File

@ -0,0 +1,19 @@
// the tail of an array
local tail(array) = std.makeArray(
std.length(array) -1,
function(x) array[x + 1],
);
local compose(functions) =
if std.length(functions) == 0
then
function(object) object
else
function(object) compose(
tail(
functions,
)
)(
functions[0](object)
);
// compose an array of functions
compose

20
package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "jsonnet-compose",
"version": "0.0.1",
"description": "function compose",
"main": "compose.libsonnet",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://sigyl.com/git/jsonnet/compose.git"
},
"keywords": [
"jsonnet",
"functional",
"compose"
],
"author": "giles bradshaw",
"license": "MIT"
}