com.saxonica.functions.hof

## Class CurriedFunction

- java.lang.Object
- - net.sf.saxon.om.AbstractItem
  - - com.saxonica.functions.hof.AbstractFunctionItem
    - - com.saxonica.functions.hof.CurriedFunction

- All Implemented Interfaces:
    PullEvent, Callable, FunctionItem, GroundedValue, Item, Sequence

      public class CurriedFunction
      extends AbstractFunctionItem

  A function obtained by currying another function, that is, the result of calling fn:partial-apply

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CurriedFunction(FunctionItem targetFunction, Sequence[] boundValues)` Create a curried function

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Sequence` | `call(XPathContext context, Sequence[] args)` Invoke the function
    `int` | `getArity()` Get the arity of the function (equal to the number of placeholders)
    `FunctionItemType` | `getFunctionItemType(TypeHierarchy th)` Get the item type of the function item
    `StructuredQName` | `getFunctionName()` Get the name of the function, or null if it is anonymous

    - ### Methods inherited from class com.saxonica.functions.hof.AbstractFunctionItem

      `deepEquals, effectiveBooleanValue, explain, getStringValue, getStringValueCS, getTypedValue, optimize, simplify, typeCheck`

    - ### Methods inherited from class net.sf.saxon.om.AbstractItem

      `getLength, head, itemAt, iterate, reduce, subsequence`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface net.sf.saxon.om.GroundedValue

      `getLength, itemAt, reduce, subsequence`

    - ### Methods inherited from interface net.sf.saxon.om.Sequence

      `head, iterate`

- - ### Constructor Detail

    - #### CurriedFunction

          public CurriedFunction(FunctionItem targetFunction,
                         Sequence[] boundValues)
                          throws XPathException

      Create a curried function
      Parameters:
        `targetFunction` - the function to be curried
        `boundValues` - the values to which the arguments are to be bound, representing unbound values (placeholders) by null
      Throws:
        `XPathException` - if any $boundArg does not exist among the arguments

  - ### Method Detail

    - #### getFunctionItemType

          public FunctionItemType getFunctionItemType(TypeHierarchy th)

      Get the item type of the function item
      Parameters:
        `th` - the type hierarchy cache
      Returns:
        the function item's type

    - #### getFunctionName

          public StructuredQName getFunctionName()

      Get the name of the function, or null if it is anonymous
      Returns:
        the function name, or null for an anonymous inline function

    - #### getArity

          public int getArity()

      Get the arity of the function (equal to the number of placeholders)
      Returns:
        the number of arguments in the function signature

    - #### call

          public Sequence call(XPathContext context,
                      Sequence[] args)
                        throws XPathException

      Invoke the function
      Parameters:
        `context` - the XPath dynamic evaluation context
        `args` - the actual arguments to be supplied
      Returns:
        the result of invoking the function
      Throws:
        `XPathException`

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.