-
Notifications
You must be signed in to change notification settings - Fork 8
Description
See https://tableauio.github.io/docs/excel/field-property/#option-refer
By default, refer means this column's values belongs to at least one of referred columns.
Current refer pattern: Sheet.Column[,Sheet.Column]..., we want to extend the pattern to be predicate(Sheet.Column[,Sheet.Column]...). Then it can be extended to support following features:
- at-least-one and every-one
- one-to-one mapping (bijective)
at-least-one and every-one
Use any when you mean “there exists at least one element meeting the condition.”
Use all when you mean “every element meets the condition.”
For example, Python programming (predicate over collections):
any(...)for “at least one”, see https://docs.python.org/3/library/functions.html#anyall(...)for “each one”, see https://docs.python.org/3/library/functions.html#all
# at least one element satisfies predicate
if any(x > 0 for x in arr):
print("at least one positive")
# each element satisfies predicate
if all(x > 0 for x in arr):
print("all positive")Proposed pattern: all(Sheet.Column[,Sheet.Column]...), By defaut, the pattern is any(Sheet.Column[,Sheet.Column]...)
one-to-one mapping (bijective)
If this feature is supported, then there is no need to support "at-least-one and every-one"?
- Maybe we can extend the pattern to
bijective(Sheet.Column[,Sheet.Column]...)to indicate that this column's values are one-to-one mapping to every one of referred columns. - Or just add an inverse
referoption to the refered sheet column (In practice, we has used it very well). - Or add a new field property
pairto signify the one-to-one mapping, and the pattern is just same asrefer.