Hi Davide, As far as I can see, there's nothing wrong with Tcl here. You just treat a list as a dict, hence the confusion. See this simpler example:
% set M {A B C D C {1 2}} A B C D C {1 2} Here, $M contains a list (actually, a string which can be interpreted as a list). But we can try to interpret it as a dict: % dict lappend M C 3 A B C {1 2 3} Here, $M is reinterpreted as a dict, with odd items A, C, C as its keys, and even items B, D, {1 2} as values. The problem is that there is the duplicate key C, so Tcl had to drop one of its values (the last one overwritten the first one upon creation of the dict). After that, 3 was appended to the list {1 2}. Cheers! -- Sergei Golovan