Map operator

Figure 49. SimpleMapExpr

SimpleMapExpr

Figure 50. ContextItemExpr

ContextItemExpr

JSONiq provides a shortcut for a for-return construct, automatically binding each item in the left-hand-side sequence to the context item.

Example 129. A simple map

(1 to 10) ! ($$ * 2)
      

Result (run with Zorba): 2 4 6 8 10 12 14 16 18 20


Example 130. An equivalent query

for $i in 1 to 10
return $i * 2
      

Result (run with Zorba): 2 4 6 8 10 12 14 16 18 20