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

array:partition → fn:partition: empty results; examples #125

Closed
ChristianGruen opened this issue Aug 15, 2022 · 1 comment
Closed

array:partition → fn:partition: empty results; examples #125

ChristianGruen opened this issue Aug 15, 2022 · 1 comment
Labels
Editorial Minor typos, wording clarifications, example fixes, etc. Enhancement A change or improvement to an existing feature XQFO An issue related to Functions and Operators

Comments

@ChristianGruen
Copy link
Contributor

ChristianGruen commented Aug 15, 2022

1. I think that an empty sequence should be returned if array:partition is invoked with an empty array. See e.g. fn:tokenize(''), which also returns an empty sequence and no zero-character string.

2. The last two example queries need to be revised, e.g. as follows:

array:partition(
  tokenize("In the beginning was the word"),
  function($previous, $current) { sum(($previous, $current) ! string-length()) gt 10 }
)

array:partition(
  (1, 2, 3, 6, 7, 9, 10),
  function($seq, $new) { not($new = $seq[last()] + 1) }
)

Maybe an affirming $add-when function is more intuitive than $break-when, in particular for function bodies with sequence operations and general comparisons.

@ChristianGruen ChristianGruen changed the title array:partition: Empty results? [FO] array:partition: Empty results? Aug 15, 2022
@ChristianGruen ChristianGruen changed the title [FO] array:partition: Empty results? [FO] array:partition: empty results; examples Aug 15, 2022
@cedporter cedporter added XQFO An issue related to Functions and Operators Editorial Minor typos, wording clarifications, example fixes, etc. Enhancement A change or improvement to an existing feature labels Sep 14, 2022
michaelhkay added a commit to michaelhkay/qtspecs that referenced this issue Apr 24, 2023
@ChristianGruen ChristianGruen changed the title [FO] array:partition: empty results; examples array:partition: empty results; examples Apr 27, 2023
@ChristianGruen ChristianGruen changed the title array:partition: empty results; examples array:partition → fn:partition: empty results; examples May 7, 2023
@michaelhkay
Copy link
Contributor

I believe that PR #454 has addressed the problems identified, and am therefore closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Editorial Minor typos, wording clarifications, example fixes, etc. Enhancement A change or improvement to an existing feature XQFO An issue related to Functions and Operators
Projects
None yet
Development

No branches or pull requests

3 participants