Function Calls

Figure 32. FunctionCall

FunctionCall

The syntax for function calls is similar to many other languages. JSONiq supports three sorts of functions:

Example 66. A builtin function call.

     keys({ "foo" : "bar", "bar" : "foo" })
   

Result (run with Zorba): foo bar


Example 67. A builtin function call.

     concat("foo", "bar")
   

Result (run with Zorba): foobar


An error is raised if the actual types do not match the expected types.

Example 68. A type error in a function call.

     sum({ "foo" : "bar" })
   

Result (run with Zorba): An error was raised: can not atomize an object item: an object has probably been passed where an atomic value is expected (e.g., as a key, or to a function expecting an atomic item)