Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better definition of amount(collection)? #31

Open
tkf opened this issue May 11, 2020 · 0 comments
Open

Better definition of amount(collection)? #31

tkf opened this issue May 11, 2020 · 0 comments

Comments

@tkf
Copy link
Member

tkf commented May 11, 2020

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.

@tkf tkf changed the title A better definition of amount(collection) Better definition of amount(collection)? May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant