Dictionary Blocks

This projects adds missing functionalities for dictionaries in Snap!.

https://snap.berkeley.edu/snap/snap.html#present:Username=tonybrown148&ProjectName=Dictionary%20Blocks

Interesting. I think you should call those things "dictionaries" or "association lists" rather than "maps" because the latter is easily confused with the MAP higher order function.

I haven't read it carefully but I think I did find one mistake:


FIND FIRST ITEM returns the value of the item, not its position in the list. (In hindsight we should have defined it that way.) So I think you meant this:

Thanks for your feedback! I have updated my project.

Going to have a play with your blocks :slight_smile:

One suggestion - since this is a large library I would put some sort of prefix symbol on all your blocks so they are easy to see that they treat lists as dictionaries
e.g
image

or find a nice unicode symbol that looks like a book maybe?

[edit] or maybe better to prefix the list to show that they are special>
image

This block doesn't seem to work properly

image

or this one

image

this bug is now fixed. thanks for your feedback.

Very interesting.

These blocks doesn't seem to work properly (if the key does not exist...)
image
image
image

I believe you should trap these errors and return an empty field or an empty list. Follows the same parrern as the original function ...

Thank for your feedback. This library is still in beta so suggestions are welcome