Commit Graph

4 Commits

Author SHA1 Message Date
Julien Fischer
d51e2a5bbb Fix the modes of array.map.
library/array.m:
    The current modes for array.map do not match what the implementation
    actually does: specifically, map does not destructively update its
    input array argument.

    Call unsafe_init/3 in a few spots where it is safe to do so.

tests/hard_coded/ho_array_ops.{m,exp}:
    Extend this test to cover array.map.
2018-08-16 16:17:13 +10:00
Julien Fischer
18c10e832d Extend the ho_array_ops test case.
tests/hard_coded/ho_array_ops.{m,exp}:
    As above.
2018-08-15 14:10:10 +10:00
Julien Fischer
a3efc705a9 Change semantics of array.map_corresponding_foldl/6.
library/array.m:
    Make array.map_corresponding_foldl/6 throw an exception if the input
    arrays differ in size.   This brings its behaviour into line with that of
    the other "corresponding" predicates.  It also avoids the unsafe behaviour
    that can currently result when the second input array has fewer elements
    than the first.

    Add some additional modes to array.map_corresponding_foldl/6.

    Replace calls to error/1 with calls to unexpected/2 throughout this
    module.

NEWS:
    Announce the above change.

tests/hard_coded/ho_array_ops.{m,exp}:
    Extend this test to cover map_corresponding_foldl/6.
2018-08-14 11:08:49 +10:00
Julien Fischer
0dc0834973 Add foldl_corresponding/5 and foldl2_corresponding/7 for arrays.
library/array.m:
    Add the above predicates.

NEWS:
    Announce the additions.

tests/hard_coded/Mmakefile:
tests/hard_coded/ho_array_ops.{m,exp}:
    Add tests of the new predicates.
2018-08-14 11:08:49 +10:00