[Q]: collection bitAnd ?

Karl Ramberg karl.ramberg at chello.se
Mon Apr 1 06:02:34 UTC 2002


Ned Konz wrote:
> 
> On Sunday 31 March 2002 02:14 pm, Karl Ramberg wrote:
> > How do I do something equal to a bitAnd for a collection?
> >
> > { 1. 2. 6.} bitAnd:[{ 3. 1. 7.}] --> #(3. 2. 7.)
> 
> { 1. 2. 6.} with: { 3. 1. 7.} collect: [ :a :b | a bitAnd: b ]
>         => #(1 0 6)
> 
> I don't know about your math. Do you mean to bitAnd: each corresponding
> element?

I don't now about math :-) But your suggestion put me on the 
right track :

{ 1. 2. 6.} with: { 3. 1. 7.} collect: [ :a :b | a max: b ] => #(3 2 7)

Thanks,
Karl



More information about the Squeak-dev mailing list