[Haskell-cafe] Lists of Lists
Sebastian Sylvan
sebastian.sylvan at gmail.com
Wed Mar 8 08:05:46 EST 2006
On 3/8/06, zell_ffhut <zell_ffhut at hotmail.com> wrote:
>
> I've tried using the Concat and ++ functions, but to no avail so far.
>
> Imagine the strings are set out in a 9x9 grid type way, and i have to find
> the value of a set position given 2 gird values.
>
> > getCharFromGrid (row,col) g = concat g !!(row * 9) + col
>
> The decleration is
>
> > getCharFromGrid :: Position -> Grid -> Char
>
> Any ideas why its not working?
Well, did you try:
getCharFromGrid (row,col) g = concat g !! (row * 9 + col)
(what you wrote would extract the col*9'th element and then add col to
that element)
Or how about:
getCharFromGrid (row,col) g = g !! row !! col
/S
--
Sebastian Sylvan
+46(0)736-818655
UIN: 44640862
More information about the Haskell-Cafe
mailing list