feat(tvix/eval): add builtins.{floor,ceil}
Change-Id: I4e6c4f96f6f5097a5c637eb3dbbd7bb8b34b7d52 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7032 Autosubmit: j4m3s <james.landrein@gmail.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
parent
bd0bf6ea7d
commit
8425c2016c
7 changed files with 13 additions and 0 deletions
|
|
@ -134,6 +134,9 @@ fn pure_builtins() -> Vec<Builtin> {
|
|||
Ok(Value::List(NixList::construct(output.len(), output)))
|
||||
},
|
||||
),
|
||||
Builtin::new("ceil", &[true], |args: Vec<Value>, _: &mut VM| {
|
||||
Ok(Value::Integer(args[0].as_float()?.ceil() as i64))
|
||||
}),
|
||||
Builtin::new(
|
||||
"compareVersions",
|
||||
&[true, true],
|
||||
|
|
@ -269,6 +272,9 @@ fn pure_builtins() -> Vec<Builtin> {
|
|||
.map(|list| Value::List(NixList::from(list)))
|
||||
.map_err(Into::into)
|
||||
}),
|
||||
Builtin::new("floor", &[true], |args: Vec<Value>, _: &mut VM| {
|
||||
Ok(Value::Integer(args[0].as_float()?.floor() as i64))
|
||||
}),
|
||||
Builtin::new(
|
||||
"foldl'",
|
||||
&[true, false, true],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue