Skip to content

Better definition of amount(collection)? #31

@tkf

Description

@tkf

Currently, amount is defined as

(1) Any empty collection must have zero `amount`.
(2) Any operation that increments `length` on collection must
increments `amount`.

So it's an upper bound of length that is monotonically increasing. Maybe this is too strict.

For example, maybe it's better to use the commented out code in

function halve(xs::Iterators.Flatten)
coll, = arguments(xs)
left, right = halve(coll)
return Iterators.flatten(left), Iterators.flatten(right)
# return _flatten(left), _flatten(right)
end
# Is this better?
# _flatten(xs) = safelength(xs) == 1 ? first(xs) : Iterators.flatten(xs)

which is impossible with the current definition of amount. But the question is how to define a useful property.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions