Page 1 of 1

RenameMapElement()

Posted: Sun Feb 14, 2021 5:39 pm
by Little John
Hi,

would it make sense to have a built-in function like the following?

Code: Select all

Macro RenameMapElement (_map_, _oldKey_, _newKey_)
   ; in: _map_: without trailing '()'
   
   If FindMapElement(_map_(), _newKey_) = #Null
      _map_(_newKey_) = _map_(_oldKey_)
      DeleteMapElement(_map_(), _oldKey_)
   EndIf
EndMacro

Re: RenameMapElement()

Posted: Mon Feb 15, 2021 8:18 pm
by Josh
Could make sense, but the pointer to the data area should not change.

Re: RenameMapElement()

Posted: Mon Feb 15, 2021 8:49 pm
by mk-soft
This will probably not happen, as maps are stored in slots.