Posted to tcl by aspect at Thu Oct 09 02:38:06 GMT 2014view raw
- tclsh-8.6.1 [tcl] % info body map
- set argNames [iota [llength $args]]
- foreach name $argNames argList $args {
- lappend cmd $name $argList
- }
- set cmdArgs [lmap a $argNames {subst {\$$a}}]
- lmap {*}$cmd {
- uplevel 1 $cmdPrefix [subst $cmdArgs]
- }
- tclsh-8.6.1 [tcl] % reify script [info body map]
- command {set argNames [iota [llength $args]]} command {foreach name $argNames argList $args {
- lappend cmd $name $argList
- }} command {set cmdArgs [lmap a $argNames {subst {\$$a}}]} command {lmap {*}$cmd {
- uplevel 1 $cmdPrefix [subst $cmdArgs]
- }}
- tclsh-8.6.1 [tcl] % lmap {kind text} [reify script [info body map]] {reify $kind $text}
- {word set word argNames word {[iota [llength $args]]}} {word foreach word name word {$argNames} word argList word {$args} word {{
- lappend cmd $name $argList
- }}} {word set word cmdArgs word {[lmap a $argNames {subst {\$$a}}]}} {word lmap expand {{*}$cmd} word {{
- uplevel 1 $cmdPrefix [subst $cmdArgs]
- }}}
- tclsh-8.6.1 [tcl] % lmap {kind text} [concat {*}[lmap {kind text} [reify script [info body map]] {reify $kind $text}]] {reify $kind $text}
- {literal set} {literal argNames} {cmdsub {iota [llength $args]}} {literal foreach} {literal name} {varsub argNames} {literal argList} {varsub args} {quoted {
- lappend cmd $name $argList
- }} {literal set} {literal cmdArgs} {cmdsub {lmap a $argNames {subst {\$$a}}}} {literal lmap} {token {{*}} varsub cmd} {quoted {
- uplevel 1 $cmdPrefix [subst $cmdArgs]
- }}
Comments
Posted by aspect at Thu Oct 09 02:40:23 GMT 2014 [text] [code]
tclsh-8.6.1 [tcl] % reify -r script [info body map] script {command {word {literal set} word {literal argNames} word {cmdsub {token {[} command {word {literal iota} word {cmdsub {token {[} command {word {literal llength} word {varsub {token {$} scalar {varname args}}}} token \]}}} token \]}}} command {word {literal foreach} word {literal name} word {varsub {token {$} scalar {varname argNames}}} word {literal argList} word {varsub {token {$} scalar {varname args}}} word {quoted {token \{ literal { lappend cmd $name $argList } token \}}}} command {word {literal set} word {literal cmdArgs} word {cmdsub {token {[} command {word {literal lmap} word {literal a} word {varsub {token {$} scalar {varname argNames}}} word {quoted {token \{ literal {subst {\$$a}} token \}}}} token \]}}} command {word {literal lmap} expand {token {{*}} varsub {token {$} scalar {varname cmd}}} word {quoted {token \{ literal { uplevel 1 $cmdPrefix [subst $cmdArgs] } token \}}}}}