我被要求做一个Wireworld线的举动,我想提出一个功能的其他功能(“help1”)内,但我不能让它工作,有多个文件 这里是我Wireworld线哈斯克尔需要帮助
module Transitions.For_List_2D (
transition_world -- :: List_2D Cell -> List_2D Cell
) where
import Data.Cell (Cell)
import Data.Cell (Cell (Head, Tail, Conductor, Empty))
import Data.Coordinates
import Data.Coordinates (Distance,X_Coord,Y_Coord,Coord,Element_w_Coord,)
import Data.List_2D
-- Replace this function with something more meaningful:
transition_world :: List_2D Cell -> List_2D Cell
transition_world w = case w of
[] -> []
x:xs -> transition_cell x : transition_world xs
transition_cell :: Element_w_Coord Cell -> Element_w_Coord Cell
transition_cell a = case a of
(Head,(x_coord,y_coord)) -> (Tail, (x_coord,y_coord))
(Tail,(x_coord,y_coord)) -> (Conductor, (x_coord,y_coord))
(Empty,(x_coord,y_coord))-> (Empty, (x_coord, y_coord))
(Conductor,(x_coord,y_coord)) -> (i want to put working function here)
help1 :: Coord -> List_2D Cell -> List_2D Cell
help1 a = case a of
x:xs
(Conductor, (x_e, y_e))-> List_2D.local_elements(element, (x_e, y_e)): help1 xs
的local_element是,我想,如果你需要查看的任何他的其他文件使用 也是另一个文件中的函数,只问 感谢任何帮助是极大的赞赏
我想你可能只是得到了'的情况下... of'和函数的语法搞砸了,我们没有看到所有的定义(比如我想'指挥,..'将是一个'Element_w_Coord Cell'但你试图用它来代替将失败的List_2D单元格) - 无论如何,试试'help(x:xs)(Conductor ...)= ...'而不是'help1 a = case X的A:XS ...'上手 – Carsten 2015-03-31 08:17:11
在任何情况下,请给我们报告给你点它显示错误(或多个) – Carsten 2015-03-31 08:18:48