Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Tcl (1990) doesn't directly have macros, but with a calling convention that resembles fexprs it doesn't need them:

    proc swap {_a _b} {
        upvar 1 $_a a
        upvar 1 $_b b
        foreach a $b b $a {}
    }
Foreach is a builtin, but is trivially defined as:

    proc each {ls script} {
        for {set i 0} {$i<[llength $ls]} {incr i} {
            uplevel 1 $script
        }
    }
Perhaps more interesting:

    proc until {cond script} {
        tailcall while "!($cond)" $script
    }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: