(bind-func dict_set:[!v,List{Pair{String*,!v}*}*,String*,!v]*
"set (or overwrite) value for key in dict (returns the old value)"
(lambda (dict key value)
(if (null? dict)
(convert null)
(if (equal (first (car dict)) key)
(let ((oldval (second (car dict))))
(tset! (car dict) 1 value)
oldval)
(if (null? (cdr dict))
(begin (append_destructive dict (list (Pair key value)))
(convert null))
(dict_set (cdr dict) key value))))))