Querying multiple collections with #where:

Burella Juan M. juan.burella at gmail.com
Mon Oct 1 18:56:44 UTC 2007


Hi Chris. I need to do something like this:

{ aMagmaCollection1 . aMagmaCollection2 }
where: [: readers |
(readers first read: #name at: 'John Player') | (readers second read: #name
at: 'Terry McKenzie') ].

or if you prefer using the Smalltalk Collection protocol from this example:

#(1 15 3 10 ) with: #(5 6 7 8) collect: [:i : j | (i max: j) ]

and then we could write

aMagmaCollection1 with: aMagmaCollection2
where: [: reader1 : reader2 | (reader1 read: #name at: 'John Player') |
(reader2 read: #name at: 'John Player')

but this one would be limited to allow only two magma collections. We
haven't found yet a simple way to do it and will be very glad if you could
suggest how you would face the solution.

I suppose this can be done this way:

(readers first read: #name at: 'John Player') union: (readers second read:
#name at: 'Terry McKenzie')

but I think #where: is somewhat optimized (?).

I'm using the latest Magma. Best regards.
Juan M.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/magma/attachments/20071001/1a830c49/attachment.htm


More information about the Magma mailing list