Why did you put a *?

b.values_at(*a)


Thanks


"WATANABE Hirofumi" <eban / os.rim.or.jp> wrote in message
news:1191-Wed20Apr2005125401+0900-eban / os.rim.or.jp...
> Hi,
>
> John Carter <john.carter / tait.co.nz> writes:
>
> > p b.lookup( 3,6,3,1,6)
> > # outputs...
> > #[4, 7, 4, 2, 7]
> >
> > h = {'tom'=>1, 'dick'=>2, 'harry'=>3}
> > p h.lookup(*%w{tom tom dick harry dick})
> > # Outputs...
> > #[1, 1, 2, 3, 2]
>
> % irb
> >> a = [3,6,3,1,6]
> => [3, 6, 3, 1, 6]
> >> b = [1,2,3,4,5,6,7,8,9,0]
> => [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
> >> b.values_at(*a)
> => [4, 7, 4, 2, 7]
> >> h = {'tom'=>1, 'dick'=>2, 'harry'=>3}
> => {"harry"=>3, "dick"=>2, "tom"=>1}
> >> h.values_at(*%w{tom tom dick harry dick})
> => [1, 1, 2, 3, 2]
>
> -- 
> eban
>
>