views:

40

answers:

1

So I found some similarities between arrays and set notation while learning about sets and sequences in precalc e.g. set notation: {a | cond } = { a1, a2, a3, a4, ..., an} given that n is the domain (or index) of the array, a subset of Natural numbers (or unsigned integer). Most programming languages would provide similar methods to arrays that are applied to sets e.g. upperbounds & lowerbounds; possibly suprema and infima too.

Where did arrays come from?

+1  A: 

Python's list comprehensions, in this respect, are as good as it gets:

[x for x in someset if x < 5]

Very "set-like". The for x in <...> part specifies which set the elements are selected from, and if x... specifies the condition.

Eli Bendersky