src/swipl-devel/packages/xpce/man/refmanual/md/quote_function.md

class quote_function {#class-quote_function}

A quote_function object may be used to avoid evaluation of a function object, notably to pass function objects over methods that would cause the function to be evaluated. Two mechanisms make quote_function objects almost transparent to functions objects:

In the following example, Chain is a chain of chains. The task is to sort the elements of the sub-chains by name.

send(Chain, for_all,
     message(@arg1, sort,
             quote_function(?(@arg1?name, compare,
                              @arg2?name))))

Without the quote_function, the function will be evaluated by the message object, while evaluation by chain ->sort is the intended behaviour.

Instance variables {#class-quote_function-instvars}

Send methods {#class-quote_function-send}



Try the rswipl package in your browser

Any scripts or data that you put into this service are public.

rswipl documentation built on June 16, 2026, 5:07 p.m.