Anonymous function: Difference between revisions

Content deleted Content added
JavaCream (talk | contribs)
Tags: Mobile edit Mobile web edit
Undid revision 1173268324 by InternetArchiveBot (talk) link can be accessed properly
Line 1,450:
 
==== Visual Prolog ====
Anonymous functions (in general anonymous ''predicates'') were introduced in [[Visual Prolog]] in version 7.2.<ref>{{cite web |title=Anonymous Predicates |url=http://wiki.visual-prolog.com/index.php?title=Language_Reference/Terms#Anonymous_Predicates }}{{Dead link|date=September 2023 |bot=InternetArchiveBot |fix-attempted=yes }} in Visual Prolog Language Reference</ref> Anonymous predicates can capture values from the context. If created in an object member, it can also access the object state (by capturing <code>This</code>).
 
<code>mkAdder</code> returns an anonymous function, which has captured the argument <code>X</code> in the closure. The returned function is a function that adds <code>X</code> to its argument: