encore
encore copied to clipboard
Special Syntax for Sets
We have syntax for lists, we should also have syntax for sets.
Good idea.
As far as I'm aware, we support only arrays. We should support lists and sets, and (hash)maps/tables. And, these should be compatible with Party types and bigvars (which don't exist yet). The new guy will look at bigvars. But the syntax can be added whenever. Also add support for comprehensions for each of them and some basic operations (esp union).
We have syntax for arrays, not lists.
+1 for comprehensions
I'm removing the "syntax overhaul" label as this is a larger change than what goes in the syntax overhaul.
Now that there are standard libraries (in existing PR) for hashmaps, sets, and lists (mutable, oo style), perhaps this could be rediscussed.
A very simple approach is as follows:
set[1,2,4,5]
is a set.
list[1,2,4,5]
is a list.
hash["foo" => 2, "bar" => 2, "baz" => 4]
is a hashtable.
Perhaps for flexibility, one could specify the type of the expected result, to enable different choices for the underlying structure. LinkedList[1,2,4,5]
vs DoublyLinkedList[1,2,4,5]
.
Which suggests that there could be some integration with constructors — let me think and create an RFC for this.