lambda(n)
πΈ lambda(n) β utility commands for anonymous procedures π
okay bestie, so this is lambda, the manual page for the Tcllib package of the same name. anonymous procedures, but make them cute and proc-like. sit down, hydrate, let's go β¨
β¨ SYNOPSIS β¨
package require Tcl 8.5 9
package require lambda ?1.1?
::lambda arguments body ?arg...?
::lambda@ namespace arguments body ?arg...?
note the ?1.1? bestie β that's the optional version, not a typo, do not come for me π
π DESCRIPTION π
so this package hands you two little convenience commands whose whole entire job is making anonymous procedures β aka lambdas β feel way more proc-like. like, main character energy instead of background-brace-chaos.
instead of writing this:
set f {::apply {{x} {
....
}}}
...which is lowkey a nesting-of-braces jump scare π
or this:
set f [list ::apply {{x y} {
....
}} $value_for_x]
...where you need a whole list command just to sneak in some of the arguments for a partial application (iykyk),
you literally just write:
set f [lambda {x} {
....
}]
and:
set f [lambda {x y} {
....
} $value_for_x]
and that's it. slay. π¦
π COMMANDS π
::lambda arguments body ?arg...?β builds an anonymous procedure out of the list ofarguments, thebodyscript, and any optional predefined argument values you toss in, then hands you back a command prefix representing that anonymous procedure.
when you actually invoke it, the body runs in a brand new procedure scope sitting right underneath the global scope, and the arguments get set to the values supplied at both construction time and invokation time. both. not one. both π
::lambda@ namespace arguments body ?arg...?β same vibe, but it also takes anamespacename. it builds the anonymous procedure from the namespace name, the list ofarguments, thebodyscript, and any optional predefined argument values, and returns a command prefix representing that anonymous procedure.
when invoked, the body runs in a new procedure scope in that namespace, with the arguments set to the values supplied at both construction and invokation time. again β both. periodt. π
heads up:::lambda@is the namespace-flavoured twin of::lambda. if you don't need a specific namespace, the plain one is right there.
π AUTHORS π
Andreas Kupries π
π BUGS, IDEAS, FEEDBACK π
fr fr, this document and the package it describes will undoubtedly contain bugs and other problems. it's giving "we know". please report them in the category lambda of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist]. π«Ά
also please report any ideas for enhancements you have for either the package and/or the documentation. we want them. we love them. bring them.
when you're proposing code changes, please provide unified diffs, i.e. the output of diff -u. bestie. the whole diff. not vibes.
note further that attachments are strongly preferred over inlined patches. you can make an attachment by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. yes, that one. the left-most one. π
π SEE ALSO π
β KEYWORDS β
anonymous procedure, callback, command prefix, currying, lambda, partial application, proc
π§ CATEGORY π§
Utility
π COPYRIGHT π
Copyright (c) 2011 Andreas Kupries, BSD licensed
okay that's the whole page bestie, you ate it, no crumbs. this was lambda(n), version 1.1, from tcllib β go forth and curry your little heart out πΈβ¨π
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- Copyright (c) 2011 Andreas Kupries, BSD licensed
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms