Skip to content

Commit

Permalink
feat(std): Add std.array.is_empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Laegluin committed Dec 3, 2018
1 parent 392f7d9 commit 8a65bc0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vm/src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ pub mod array {
array.len() as VmInt
}

pub fn is_empty(array: Array<generic::A>) -> bool {
array.len() == 0
}

pub(crate) fn index<'vm>(
array: OpaqueRef<'vm, [generic::A]>,
index: VmInt,
Expand Down Expand Up @@ -536,6 +540,7 @@ pub fn load_array(vm: &Thread) -> Result<ExternModule> {
vm,
record! {
len => primitive!(1, std::array::prim::len),
is_empty => primitive!(1, std::array::prim::is_empty),
index => primitive!(2, std::array::prim::index),
append => primitive!(2, std::array::prim::append),
slice => primitive!(3, std::array::prim::slice)
Expand Down

0 comments on commit 8a65bc0

Please sign in to comment.