Permalink
Browse files

Implement curry with alias

Signed-off-by: Steve Bennett <steveb@workware.net.au>
  • Loading branch information...
1 parent 043dadf commit a7b70857c62003d1f43352bd9a5499f87a2100f6 @msteveb committed Dec 2, 2011
Showing with 2 additions and 6 deletions.
  1. +2 −6 stdlib.tcl
View
@@ -1,7 +1,6 @@
# Creates an anonymous procedure
proc lambda {arglist args} {
- set name [ref {} function lambda.finalizer]
- tailcall proc $name $arglist {*}$args
+ tailcall proc [ref {} function lambda.finalizer] $arglist {*}$args
}
proc lambda.finalizer {name val} {
@@ -10,10 +9,7 @@ proc lambda.finalizer {name val} {
# Like alias, but creates and returns an anonyous procedure
proc curry {args} {
- set prefix $args
- lambda args prefix {
- tailcall {*}$prefix {*}$args
- }
+ alias [ref {} function lambda.finalizer] {*}$args
}
# Returns the given argument.

0 comments on commit a7b7085

Please sign in to comment.