brownplt / pyret-docs

The documentation for Pyret.
9 stars 18 forks source link

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

Closed shriram closed 4 months ago

shriram commented 10 months ago

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!