Updated 2018-03-28 16:40:56 by pooryorick

lproc is like proc, except that the body is a list of lists and no string representation of the body is generated.

See Also  edit

ycl proc lproc
The implementation of lproc shown below.
Playing newLISP
Employs a similar pattern.

Implementation  edit

proc lproc {name args list} {
    uplevel 1 [list ::interp alias {} [namespace current]::$name {} ::apply [
        list [list list {*}$args] {
            ::apply [list {} {
                upvar 1 list list 
                ::foreach line $list[unset list] {
                    if {[catch {::uplevel 1 $line} cres copts]} {
                        dict incr copts -level
                        return -options $copts $cres
                    }
                }
            } [namespace current]]
        } [uplevel 1 {namespace current}]
    ] $list]
}