We provide function application via the predicates call/n. This predicate takes as a first argument a term which plays the role of a closure, then extends it by the remaining n-1 arguments and calls the resulting goal. Since the closure need not necessarily be an atom but can also be a compound, it is possible to create closures that carry around data.

Example:
`?- [user].writeln(X) :- write(X), nl.^D?- call(writeln, hello).hell`

The call/n predicates also work for qualified closures. A qualified closure is similarly extended to an unqualified closure. The arguments will be added to the inner unqualified closure and the qualification will be preserved. So extending a:b(X) by Y results in a:b(X,Y). The predicates sys_modext_args/[3..9] allow to call the argument extension without further invoking the result.

Example:
`?- X is call(sin,0.2).X = 0.19866933079506122?- Y = sin, X is call(Y,0.2).Y = sin,X = 0.19866933079506122`

Thanks to bridging it is also possible to use the call/n predicates inside arithmetic expressions. The bridge will turn the call/n evaluable function into a call/n+1 predicate with the desired effect.

The following apply predicates are provided:

sys_modext_args(P, Y1, .., Yn, Q):
The predicate adds the arguments Y1, .., Yn to the callable P and unifies the result with Q. The result Q will have the same call-site information and the same colon and double notation as the callable P. The predicate is currently defined for 1 ≤ n ≤ 7.
call(P, Y1, .., Yn): [TC2 8.15.4]
The goal call(p(X1, .., Xm), Y1, .., Yn) succeeds whenever the goal p(X1, .., Xm, Y1, .., Yn) succeeds. The predicate is currently defined for 1 ≤ n ≤ 7.