[m-users.] Cartesian product of two sets of things.

Julien Fischer jfischer at opturion.com
Tue Oct 10 17:09:20 AEDT 2023


On Mon, 9 Oct 2023, Sean Charles (emacstheviking) wrote:

> The output is two lists, the object IDs of those things involved in collisions.
> 
> My question then is, given the two loops are basically generating a
> cartesian product, is there a module function somewhere that would do
> that for me, generate a single list of all pairs? Then I could
> list.chunk and maybe produce a cleaner bit of code. I am currently
> also considering on uncommenting out the set_hit() typeclass predicate
> so that I can modify the objects in place, so instead of returning two
> sets of objects ID,s I'd be returning a new set of objects with their
> respective hit flags set.

My questions are: what do you do with those object ids once you have
them? And could you do whatever that is inside the loop that generates
the Cartesian product without building up a list or set containing the
product?

Julien.


More information about the users mailing list