f::lambda (public, deprecated)
f::lambda args body
Defined in packages/acs-tcl/tcl/ad-functional-procs.tcl
Deprecated. Invoking this procedure generates a warning.
The lambda function - one of the foundations of functional programming - defines an anonymous proc and returns it. This is useful if you quickly need an auxiliary function for a small task.
Examples
map [lambda {x} {expr $x*$x}] {1 2 3 4 5}
= {1 4 9 16 25}zip_with [lambda {x y} {return "$x and $y"}] {1 2 3} {4 5 6}
= "1 and 4" "2 and 5" "3 and 6"Note
Although lambda defines a proc and therefore consumes memory, executing the same lambda expression twice will just re-define this proc. Thus, there is no memory leak, if you have a lambda inside a loop. DEPRECATED: As of tcl8.5, Tcl has native support for 'lambda' provided by means of 'apply' per TIP 194. Tcllib provides a 'lambda' package with procs that make use of it.
- Parameters:
- args
body
See Also:- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: ns_log Notice "Deprecated proc f::lambda used:\n[ad_get_tcl_call_stack]" proc $args.$body $args $body return $args.$bodyXQL Not present: Generic, PostgreSQL, Oracle