File: tailcall.tcl

package info (click to toggle)
tcl-sugar 0.1-1.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 176 kB
  • sloc: tcl: 647; sh: 13; makefile: 2
file content (10 lines) | stat: -rw-r--r-- 158 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
package require sugar

sugar::tailrecproc printlist l {
    if {[llength $l]} {
	puts [lindex $l 0]
	printlist [lrange $l 1 end]
    }
}

printlist {1 2 3 4}