@main[] $h[^hash::create[]] ^first_and_last[Empty hash (^$h[^^hash::create[]]);$h] $h.1[a] ^first_and_last[One element was added (^$h.1[a]);$h] ^h.delete[1] ^first_and_last[One element was deleted (^^h.delete[1]);$h] $h.1[a] ^first_and_last[One element was added (^$h.1[a]);$h] $h[ $.1[a] $.2[b] $.3[c] $.4[d] $.5[e] ] ^first_and_last[Hash with 5 elements (^$h[ ^$.1[a] ^$.2[b] ^$.3[c] ^$.4[d] ^$.5[e] ]);$h] ^h.delete[5] ^first_and_last[The last element was deleted (^^h.delete[5]);$h] ^h.delete[1] ^first_and_last[The first element was deleted (^^h.delete[1]);$h] $h.5[e] ^first_and_last[One element was added at the end (^$h.5[e]);$h] $h.3[cc] ^first_and_last[One element was added at the middle (^$h.3[cc]);$h]

_at on hash with 5 elements (^$h[ ^$.1[a] ^$.2[b] ^$.3[c] ^$.4[d] ^$.5[e] ])

$h[ $.1[a] $.2[b] $.3[c] $.4[d] $.5[e] ] ^at(0) ^at(1) ^at(2) ^at(3) ^at(4)
^at(-1) ^at(-2) ^at(-3) ^at(-4) ^at(-5)
^at(0)[key] ^at(1)[key] ^at(2)[key] ^at(3)[key] ^at(4)[key]
^at(0)[value] ^at(1)[value] ^at(2)[value] ^at(3)[value] ^at(4)[value]
^at(0)[hash] ^at(1)[hash] ^at(2)[hash] ^at(3)[hash] ^at(4)[hash]
# check if values preserve tainting. keys are always lost tainting

The first element was replaced (^$h.1[b&b])

$h.1[b&b] ^^h._at[first;hash]=^print[^h._at[first;hash]]
^at(0)[key] ^at(0)[value] ^at(0)[hash]

One element was added at the end (^$h.[c&c][^^taint[d&d]])

$h.[c&c][^taint[d&d]] ^at(5)[key] ^at(5)[value] ^at(5)[hash] ^^h._at[last;hash]=^print[^h._at[last;hash]]

^do[^^h._at[]]{must fail^h._at[]} ^do[^^h._at[first^;key^;hren]]{must fail^h._at[first;key;hren]} ^do[^^h._at(1){code}]{must fail^h._at(1){code}} ^do[^^h._at(1)(true)]{must fail^h._at(1)(true)} ^do[^^h._at[hren]]{must fail^h._at[hren]} ^do[^^h._at[first][hren]]{must fail^h._at[first][hren]} ^do[^^h._at[last][hren]]{must fail^h._at[last][hren]} ^do[^^h._at(1)[hren]]{must fail^h._at(1)[hren]} @at[i;type] ^^h._at($i)^if(def $type){[$type]}=^print[^if(def $type){^h._at($i)[$type]}{^h._at($i)}]
@first_and_last[sTitle;h] ^if(def $sTitle){

$sTitle

} first:last='^h._at[first]':'^h._at[last;value]'
first_key:last_key='^h._at[first;key]':'^h._at[last;key]'
@do[label;code] $label=^try{${code}}{$exception.handled(true)^taint[as-is;$exception.comment]}
@print[u][k;v] ^if($u is "hash"){ $result[^u.foreach[k;v]{'$k':'$v'}[, ]] }{ $result[$u] }