Comments (3)
I'm trying to get to the bottom of this.
First problem I think is that otherwise
binds more tightly than +
, so it should be
let $start := index-where($input, $from)[1] otherwise (count($input) + 1)
I'm then getting a problem that in test subsequence-before-002, the expression mock:subsequence-where($in, to:=$pred)
returns a different result from mock:subsequence-where($in, from:=true#0, to:=$pred)
. That must be a bug in Saxon's handling of default function parameters.
Got it: the code wasn't handling keyword arguments correctly in the case of functions imported from a library module. (There aren't many tests for that...)
from qtspecs.
Most of the subsequence-where
tests are now passing using a mock implementation based on the equivalence expression in the spec, with parentheses added as described above.
The exceptions are tests subsequence-after-001, and subsequence-ending-where-101 to -108.
Those turned out to be errors in the way I converted the tests to call the mock version of the function. With that fixed, all the tests are now producing the expected results using the function:
declare function mock:subsequence-where (
$input as item()*,
$from as (function(item(), xs:integer) as xs:boolean)? := true#0,
$to as (function(item(), xs:integer) as xs:boolean)? := false#0
) as item()*
{
let $start := trace(index-where($input, $from)[1]
otherwise (count($input) + 1), '$start')
let $end := trace(index-where($input, $to)[. ge $start][1]
otherwise (count($input) + 1), '$end')
return slice($input, $start, $end)
};
As this exercise found a couple of Saxon bugs, I'm inclined to keep the tests for posterity...
from qtspecs.
Fixed by PR #1025
from qtspecs.
Related Issues (20)
- Almost all functions in FO that must process multiple string items, can have as a parameter only a single collation HOT 21
- For symmetry, add functions array:scan-left and array:scan-right HOT 1
- fn:apply argument names
- Dangling else syntax ambiguity HOT 9
- add fn:match-groups() function HOT 7
- Tokenization and element constructors HOT 6
- Productions missing ws:explicit
- Ambiguity in XPath EBNF - Lookup with TypeQualifier vs DynamicFunctionCall HOT 9
- 12 div-3 HOT 5
- XPath: type declarations in quantified expressions
- Record Test Subtype Relationship HOT 3
- Function Coercion: Drop Record Tests? HOT 3
- Specification Documents: Editors and Contributors
- fn:parse-uri: Observations HOT 1
- Leading lone slash
- fn:collation-available (editorial)
- Function parameters names: $uri vs. $href HOT 6
- Executable specifications HOT 1
- Variadic System Functions: Principles? HOT 3
- Misleading summary for concat() - "string value"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qtspecs.