Short-hand partial application example added to README.md
parent
bb9107c8c1
commit
e392d411fa
|
@ -70,11 +70,17 @@ the output included within a distribution.
|
||||||
### Partial Applications
|
### Partial Applications
|
||||||
Dynamic function applications using `f:apply` are partially applied if
|
Dynamic function applications using `f:apply` are partially applied if
|
||||||
the number of arguments provided is less than the arity of the target
|
the number of arguments provided is less than the arity of the target
|
||||||
function.
|
function. For convenience, the `apply-gen` stylesheet will also
|
||||||
|
generate functions to perform partial application without the use of
|
||||||
|
`f:apply` for the first call, as in the first example below:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<!-- produces a new dynamic function of arity 5 - 3 = 2 -->
|
<!-- produces a new dynamic function of arity 5 - 3 = 2 -->
|
||||||
<variable name="partial"
|
<variable name="partial"
|
||||||
|
select="my:arity5( 1, 2, 3 )" />
|
||||||
|
|
||||||
|
<!-- does the same, the long way -->
|
||||||
|
<variable name="partial-long"
|
||||||
select="f:apply( my:arity5(), 1, 2, 3 )" />
|
select="f:apply( my:arity5(), 1, 2, 3 )" />
|
||||||
|
|
||||||
<!-- consequently, currying is supported -->
|
<!-- consequently, currying is supported -->
|
||||||
|
@ -84,6 +90,7 @@ function.
|
||||||
<!-- equiv = true() -->
|
<!-- equiv = true() -->
|
||||||
<variable name="equiv"
|
<variable name="equiv"
|
||||||
select="$result
|
select="$result
|
||||||
|
= f:apply( my:arity5( 1, 2, 3 ), 4, 5 )
|
||||||
= f:apply( my:arity5(), 1, 2, 3, 4, 5 )
|
= f:apply( my:arity5(), 1, 2, 3, 4, 5 )
|
||||||
= my:arity5( 1, 2, 3, 4, 5 )" />
|
= my:arity5( 1, 2, 3, 4, 5 )" />
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue