parapluu / encore

The Encore compiler.
BSD 3-Clause "New" or "Revised" License
43 stars 26 forks source link

Special Syntax for Sets #231

Open kaeluka opened 9 years ago

kaeluka commented 9 years ago

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

supercooldave commented 9 years ago

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

EliasC commented 9 years ago

We have syntax for arrays, not lists.

EliasC commented 9 years ago

+1 for comprehensions

EliasC commented 7 years ago

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

supercooldave commented 7 years ago

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.