Re: lambda... again
- From: suchenwi <richard.suchenwirth-bauersachs@xxxxxxxxxxx>
- Date: Tue, 23 Oct 2007 00:32:41 -0700
On 23 Okt., 03:22, "slebet...@xxxxxxxxx" <slebet...@xxxxxxxxx> wrote:
The disadvantage is that calling a lambda is different from calling a
regular proc (you need to prepend apply to it). Now... if someone
feels like modifying [unknown] so that lambdas can be called like a
proc.....
Oh, that's easily done:
% proc know what {
if ![info complete $what] {error "incomplete command(s) $what"}
proc unknown args $what\n[info body unknown]
}
% know {
if {[llength [lindex $args 0]]==2} {return [eval [linsert $args 0
apply]]}
}
% set try {{a b} {expr {$a * $b}}}
{a b} {expr {$a * $b}}
% $try 7 6
42
It just conflicts with spaces in command names, so don't do both... :^)
.
- Follow-Ups:
- Re: lambda... again
- From: slebetman@xxxxxxxxx
- Re: lambda... again
- References:
- lambda... again
- From: yuriy . ershov
- Re: lambda... again
- From: slebetman@xxxxxxxxx
- lambda... again
- Prev by Date: Remote Debugging
- Next by Date: Re: exec issues with globbing
- Previous by thread: Re: lambda... again
- Next by thread: Re: lambda... again
- Index(es):
Relevant Pages
|