-
Notifications
You must be signed in to change notification settings - Fork 15
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
125: array:partition #454
125: array:partition #454
Conversation
Now that you mention it, I think that
If we want to stick with the |
I have made further changes to rename array:partition as fn:partition |
<eg>fn:fold-left($input, (), function($partitions, $next) { | ||
if (empty($partitions) or $break-when($partitions[last()]?*, $next)) | ||
then ($partitions, [$next]) | ||
else (fn:trunk($partitions), array{$partitions[last()], $next}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else (fn:trunk($partitions), array{$partitions[last()], $next}) | |
else (trunk($partitions), array{foot($partitions), $next}) |
I'm not sure about all these changes. The return type: it's an sequence of arrays; each array has one or more members, and each member is a single item. I think that's correctly expressed as Use of "fn:" prefix. In the past examples in the specs have always had a convention that calls to functions in the |
So true. Sorry. About time to skip the morning hours again.
Interesting: I spotted many examples that omitted the prefix (that’s even the case in the given pull request – see I think there’s just one example that would be better readable – if written as |
qt4cg/qtspecs#454: array:partition → fn:partition
qt4cg/qtspecs#454: array:partition → fn:partition
@michaelhkay I’m afraid, it seems the PR needs to be fixed due to my cleanups. |
I'm going to scrap this PR and raise a new one. |
This PR revisits array:partition, with extra editorial clarification of the spec; including but not confined to fixing issue #125.
I suggest we schedule this PR for discussion since we have not previously discussed it.
One question for the group is what the name of the function should be (including the choice of namespace).
Another is whether the polarity of the callback function should be changed (from
break-when
tocontinue-when
or similar).We could also consider returning an array of sequences rather than a sequence of arrays. (But in my view sequences of arrays are rather easier to manage at the moment.)