lprepend - insert elements in front of a list
This is not a command included in Tcl. It is useful for implementing stacks and queues. lunshift implements the same functionality, but only for one element.
See also: lpop, lshift and Chart of existing list functionality.
proc lprepend {listVar args} { upvar 1 $listVar l lappend l; # bring l to live. set l [K* [concat $args $l] [set l {}]] }
LV you reference a function called K* - where is that implemented?
aricb I believe that's the "generalized K combinator":
proc K* {arg args} {set arg}
LEG: Yes, it is the generalized Kombinator and sorry: here comes the "pure Tcl" implementation of lprepend:
proc lprepend {listVar args} { upvar 1 $listVar l lappend l; # bring l to live. set l [concat $args $l[set l {}]] }