我需要做一个wireworld移动,我想把一个函数放在另一个函数中(" help1")但是我不能让它工作,有多个文件 这就是我所拥有的
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是我想要使用的另一个文件的函数 如果你需要查看他的任何其他文件,请问 非常感谢任何帮助
答案 0 :(得分:0)
你的help1
函数需要两个参数,但你只给它一个。
尝试类似
的内容help1 coord world = case world of
尝试在列表递归上进行实验,并停止在堆栈溢出上发布作业问题,尤其是使用您的真实姓名。