[Jprogramming] problem
Raul Miller
rauldmiller at gmail.com
Fri Aug 28 20:48:53 HKT 2009
On Fri, Aug 28, 2009 at 4:39 AM, Sherlock, Ric<R.G.Sherlock at massey.ac.nz> wrote:
> I'm not convinced that this solution meets the spec given for the RosettaCode problem "Basic bitmap storage"
> http://rosettacode.org/wiki/Basic_bitmap_storage
>
> allocimg=: 0 $~ 3 ,~ ]
> fillimg=: ]`(a:"_)`[}
> setpix=: (1&{::@])`([: <@;/ <:@(0&{::@]))`[}
> getpix=: <@;/@:<:@] { [
>
> myimg=: allocimg 10 7 NB. 10 by 7 pixel image
> myimg=: myimg fillimg 0 255 0 NB. fill with green
> myimg getpix 4 5 NB. get color of pixel from 4th row and 5th col
> 0 255 0
> myimg=: myimg setpix 4 5; 255 0 255 NB. set pixel to magenta
> myimg getpix 4 5 NB. verify
> 255 0 255
>
> I'm thinking that I probably need to pass the name rather than the value of the image object?
I see nothing in the specs even suggesting that call by value should
not be used.
--
Raul
More information about the Programming
mailing list