0

我第一次使用haskell光泽,我遇到了一些麻烦,在这段代码中:

-- the initial c and l will be imagine for dimension 9: (-160) 160 
-- (so the square ends in the center of the window

--         column;  line;   dimension   
drawmap :: Float -> Float -> Float -> Picture
drawmap c l d = (drawline x c l d) : (drawmap xs c (l+40) d)

drawline :: Float -> Float -> Float -> Picture
drawline c l d = if (d>0) then (Translate c l $ Color red (circle 20)) : (drawline (c+40) l (d-1))
                          else (Translate c l $ Color red (circle 20))

我现在唯一的问题是类型,因为我需要它是类型图片,而不是 [图片],有什么帮助吗?

而且,我该如何做这个停止点:

drawline _ _ 0 = Nothing or [] 

我知道这是不可接受的,但我如何告诉它何时停止做圆圈?

这根本不实用,只是一个非常简单的例子,如果有人帮助我理解这一点,我可以在应用我真正需要做的事情后。

4

0 回答 0