bloom-lang / bud

Prototype Bud runtime (Bloom Under Development)
http://bloom-lang.net
Other
854 stars 60 forks source link

Support deterministic ordinal assignment within a timestep #224

Closed neilconway closed 13 years ago

neilconway commented 13 years ago

It would be nice to provide a convenient, efficient way to assign ordinals to the contents of a set within a single timestep, in a deterministic way. It is easy to get determinism if we spread the assignment out over time, and there is existing code that does ordinal assignment in a single timestep (AggAssign) in the sandbox, but it is not deterministic.

neilconway commented 13 years ago

This turns out to be pretty easy to solve: sort the collection (via Ruby), and then use an element's ordinal position as its ID. This should be safe, because sort should be treated as non-monotonic. Details: