encore icon indicating copy to clipboard operation
encore copied to clipboard

Special Syntax for Sets

Open kaeluka opened this issue 9 years ago • 5 comments

We have syntax for lists, we should also have syntax for sets.

kaeluka avatar Oct 02 '15 09:10 kaeluka

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).

supercooldave avatar Oct 02 '15 10:10 supercooldave

We have syntax for arrays, not lists.

EliasC avatar Oct 02 '15 10:10 EliasC

+1 for comprehensions

EliasC avatar Oct 02 '15 11:10 EliasC

I'm removing the "syntax overhaul" label as this is a larger change than what goes in the syntax overhaul.

EliasC avatar Feb 08 '17 12:02 EliasC

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.

supercooldave avatar Jun 18 '17 07:06 supercooldave