pyret-lang icon indicating copy to clipboard operation
pyret-lang copied to clipboard

`string-dict` `.add` should show dictionary extension

Open shriram opened this issue 2 years ago • 0 comments

All the examples in the docs

https://pyret.org/docs/latest/string-dict.html#%28part.string-dict.String.Dict_string-dict_set%29

only show updates to existing fields, misleading readers into thinking you can't use this to extend a dictionary. A test like this can help:

check:
  s1 = [string-dict: ]
  s2 = s1.set("Hello", "World")
  s2.get("Hello") is some("World")
end

Thanks to Sam Weiss (CSCI 0190) for pointing this out!

shriram avatar Nov 01 '23 15:11 shriram