Quick'n'dirty

Purpose: show some solutions-on-the-fly. Try all cruelties to this language you can imagine!

Rationale: some days I feel unhappy if there is no occasion to do something quick'n'dirty. (The rest of the year, I'm a nice guy.)


wdb In earlier years for my project One Hand Content there was no lassign yet. Thus I made a Lisp-style let, also minimalistic style:

 proc let args {uplevel foreach $args break}

It works as follows: the call

 let {a b} {apple banana}

expands to

 foreach {a b} {apple banana} break

with side-effect that variables a, b are set.

How to swap variables:

 let {a b} [list $b $a]

which expands to

 foreach {a b} {banana apple} break

Benefits: no infix syntax introduced, just pure Tcl styled polish notation (German: Polnische Notation).


[Do you play Tina Turner while coding?] -- No, as long as I'm coding, there is no music necessary.