Struggling with lists of lists in Haskell

前端 未结 2 519
失恋的感觉
失恋的感觉 2021-01-28 15:36

Can anybody help me with this function?

 getCell :: [[Int]] -> Int -> Int -> Int  

Where m i j are the indexes of the lines and the c

2条回答
  •  一向
    一向 (楼主)
    2021-01-28 16:09

    Just for fun - one liner

    getCell l i j = (((l ++ repeat []) !! i) ++ repeat (-1)) !! j 
    

提交回复
热议问题