File: lambda.man

package info (click to toggle)
tcllib 1.14-dfsg-3%2Bdeb7u1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 33,036 kB
  • sloc: tcl: 148,302; ansic: 14,067; sh: 10,320; xml: 1,766; yacc: 753; pascal: 551; makefile: 129; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (93 lines) | stat: -rw-r--r-- 2,590 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin lambda n 1]
[copyright {2011 Andreas Kupries, BSD licensed}]
[moddesc {Utility commands for anonymous procedures}]
[titledesc {Utility commands for anonymous procedures}]
[category  Utility]
[require Tcl 8.5]
[require lambda [opt 1]]
[keywords lambda {anonymous procedure} callback {command prefix}]
[keywords {partial application} currying proc]
[see_also apply(n) proc(n)]
[description]
[para]

This package provides two convenience commands to make the writing of
anonymous procedures, i.e. lambdas more [cmd proc]-like. Instead of,
for example, to write

[example {
     set f {::apply {{x} {
        ....
     }}}
}]

with its deep nesting of braces, or

[example {
     set f [list ::apply {{x y} {
        ....
     }} $value_for_x]
}]

with a list command to insert some of the arguments of a partial
application, just write

[example {
     set f [lambda {x} {
        ....
     }]
}]

and

[example {
     set f [lambda {x y} {
        ....
     } $value_for_x]
}]

[section {COMMANDS}]

[list_begin definitions]
[comment {- - -- --- ----- -------- ------------- ---------------------}]
[call [cmd ::lambda] [arg arguments] [arg body] [opt [arg arg]...]]

The command constructs an anonymous procedure from the list of
arguments, body script and (optional) predefined argument values and
returns a command prefix representing this anonymous procedure.

[para] When invoked the [arg body] is run in a new procedure scope
just underneath the global scope, with the arguments set to the values
supplied at both construction and invokation time.


[comment {- - -- --- ----- -------- ------------- ---------------------}]
[call [cmd ::lambda@] [arg namespace] [arg arguments] [arg body] [opt [arg arg]...]]

The command constructs an anonymous procedure from the namespace name,
list of arguments, body script and (optional) predefined argument
values and returns a command prefix representing this anonymous
procedure.

[para] When invoked the [arg body] is run in a new procedure scope in
the [arg namespace], with the arguments set to the values supplied at
both construction and invokation time.

[list_end]

[section AUTHORS]
Andreas Kupries

[section {BUGS, IDEAS, FEEDBACK}]

This document, and the package it describes, will undoubtedly contain
bugs and other problems.

Please report such in the category [emph lambda] of the
[uri {http://sourceforge.net/tracker/?group_id=12883} {Tcllib SF Trackers}].

Please also report any ideas for enhancements you may have for either
package and/or documentation.

[manpage_end]