[Bug 17600] Range predicates

https://www.w3.org/Bugs/Public/show_bug.cgi?id=17600

--- Comment #6 from John Snelson <john.snelson@marklogic.com> 2012-06-26 14:50:31 UTC ---
(In reply to comment #5)
> Does it have to be a sequence of numeric values for every item in the input?

No.

> $seq[if (f(.)) then number(@min) to number(@max) else is-married(.)]
> 
> I think the overloading of predicates is bad enough already without introducing
> this.

It might be slightly more complicated to evaluate, but it's actually extremely
useful to users. The full semantics of a predicate expression "SEQ[PRED]" under
this proposal could be expressed as such:

for $s at $p in SEQ
where
  typeswitch($s)
  case op:numeric+ return $p = $s
  default return fn:boolean($s)
return $s

This is not a very big departure from the present semantics:

for $s at $p in SEQ
where
  typeswitch($s)
  case op:numeric return $p eq $s
  default return fn:boolean($s)
return $s

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 26 June 2012 14:50:37 UTC