set =
{{expression [(..|to) expression [by expression]] [,]} } |
{ all [expression for] iterator }
Sets specified using the form:
{ all iterator }are constructed by simply including all the values generated by the iterator
into the set (eliminating duplicates, of course).
For example: {all i in [1 1 2 2 3 3 4 4]} = {1 2 3 4}When
used to construct set and list values, iterators usually include filters,
for example: {all i in [1..100] | is_a_prime_number(i)}The
latter usage corresponds to the ZF construct of Classical Mathematics, with
the exception that iterators that would generate
infinitely many elements actually generate none.
For example: {all x in Number | is_a_prime_number(x)} = {}
{all y in Entity | y not in y} = {}It is my intention, eventually,
to improve the implementation of Slim to such an extent that sets such as
the above behave as they do in Classical Mathematics, with the
exception of paradoxical set formers, such as the second example above,
which will either result in empty sets or generate compile-time errors.
Iterators (with or without filters) can also be combined with an expression:
{ all expression for iterator }
For example: {all i * (i+1) for i in [1..5]} = {2, 6, 12, 20, 30}