initial commit
This commit is contained in:
parent
3a4389f772
commit
fe42a75907
|
@ -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
|
|
@ -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"
|
||||
}
|
Loading…
Reference in New Issue