Sequence Flow Control and Typing

Examples
  1. (3 idiv 2,(2,(3)),(),4 to 6)
  2. reverse(reverse(1 to 6))
  3. (1 to 6)[. mod 1 eq 0]
  4. (1 to 6)[. < 10]
  5. (0 to 5)!(. + 1)
  6. (1 to 3)!(.*2-1 , .*2)
  7. let $a := (1 to 3), $b := (4 to 6)
return ($a,$b)
  1. for $i in (0,3), $j in (1,2,3) return ($i + $j)
  2. if (5 le 5) then (1 to 6) else (0)
(10)(1 to 6) treat as xs:decimal+
GIVE
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  1. 2 = (1,2,3)
  2. 3 > (2,4)
  3. (1,2) = (2,3)
  4. (1,2) != (2,3)
  5. some $x in (1 to 3), $y in (2 to 4)
satisfies $x + $y < 4
  1. every $x in (1 to 3), $y in (2 to 4)
    satisfies $x + $y > 0
  2. 15 instance of xs:integer
  3. 15 instance of item()
  4. (1,2) instance of xs:integer+
(10)  xs:unsignedByte(1) instance of xs:integer
(11)  xs:dateTime('2015-03-04T12:00:00')
instance of xs:anyType
(12)  xs:dayTimeDuration('P9DT15H30M30S')
instance of xs:duration
(13)  1.3 castable as xs:integer
(14)  1.3 cast as xs:Boolean
(15)  xs:date('2015-08-31') >
xs:date('2015-07-31')
GIVE
True
  1. xs:dayTimeDuration("P30D")
  2. "P30D" cast as xs:dayTimeDuration?
  3. xs:dayTimeDuration('P20D') + xs:dayTimeDuration('P10D')
  4. xs:date('2015-03-04') - xs:date('2015-02-02')
GIVE
P30D
(1,2) = (2,3) is equivalent to: 1=2 or 1=3 or 2=2 or 2=3