You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having a hard time structuring my pipes consistently, due to the fixed order of arguments for template functions.
I would like to change the order of arguments.
Is this at all possible when applying template functions? (Please don't say named templates, that would be a verbose monster)
A couple of examples.
I like reading a pipeline like:
{{5 | lt4 | ternary"yay""nay"}}
which in my mind I can easily translate into "5, is less than 4, if true 'yay' otherwise 'nay'".
However, for some functions the order is wrong in my opinion, e.g.:
{{"someKey" | index.Values}}
which I would rather do as:
{{.Values | index"someKey"}}
This becomes more obvious when the first pipe (piped as last argument) becomes something more dynamic.
In general, I would like the argument which is typically more dynamic to be passed as the last argument.
I would like to do:
{{include"createSomeDict" . | index"someKey"}}
Which is not actually possible, only by moving around the arguments, such as:
which is basically the same function as the passed argument f, but with flipped order of arguments x and y when flip applies f.
This is not quite what would be possible for Helm, since functions are not first-class citizens and therefore not possible to partially apply a function.
The text was updated successfully, but these errors were encountered:
I am having a hard time structuring my pipes consistently, due to the fixed order of arguments for template functions.
I would like to change the order of arguments.
Is this at all possible when applying template functions? (Please don't say named templates, that would be a verbose monster)
A couple of examples.
I like reading a pipeline like:
which in my mind I can easily translate into "5, is less than 4, if true 'yay' otherwise 'nay'".
However, for some functions the order is wrong in my opinion, e.g.:
which I would rather do as:
This becomes more obvious when the first pipe (piped as last argument) becomes something more dynamic.
In general, I would like the argument which is typically more dynamic to be passed as the last argument.
I would like to do:
Which is not actually possible, only by moving around the arguments, such as:
However, it might be possible to do with a
flip
function, e.g.:For F#, I would have defined a function
flip
:which is basically the same function as the passed argument
f
, but with flipped order of argumentsx
andy
whenflip
appliesf
.This is not quite what would be possible for Helm, since functions are not first-class citizens and therefore not possible to partially apply a function.
The text was updated successfully, but these errors were encountered: