elvish_config/lib/moi/util/condition.elv

21 lines
228 B
Plaintext
Raw Normal View History

2021-12-11 21:09:02 +00:00
fn cset {|c t f|
2020-03-13 14:03:36 +00:00
if $c {
put $t
} else {
put $f
}
}
2021-12-11 21:09:02 +00:00
fn mset {|c t f|
all (cset $c $t $f)
2020-03-13 14:03:36 +00:00
}
2021-12-11 21:09:02 +00:00
fn call {|c t f @argv|
2021-08-27 20:06:49 +00:00
var v = (cset $c $t $f)
2020-03-13 14:03:36 +00:00
if (is (kind-of $v) fn) {
$v $@argv
} else {
put $v
}
}