我正在尝试在Haskell中实现龟图形.目标是能够编写如下函数:
draw_something = do
forward 100
right 90
forward 100
...
Run Code Online (Sandbox Code Playgroud)
然后让它产生一个点列表(可能有其他属性):
> draw_something (0,0) 0 -- start at (0,0) facing east (0 degrees)
[(0,0), (0,100), (-100,100), ...]
Run Code Online (Sandbox Code Playgroud)
我已经以"正常"的方式工作了所有这些,但我没有将它作为Haskell Monad实现并使用do-notation.基本代码:
data State a = State (a, a) a -- (x,y), angle
deriving (Show, Eq)
initstate :: State Float
initstate = State (0.0,0.0) 0.0
-- constrain angles to 0 to 2*pi
fmod :: Float -> Float
fmod a
| a >= 2*pi = fmod (a-2*pi)
| a < 0 …Run Code Online (Sandbox Code Playgroud) 我正在为旧的MS-DOS计算机编写程序,这比任何事情都有趣。我使用Linux(Fedora 19)作为开发机器,并使用OpenWatcom 1.9编译我的代码。
现在,我想在我的项目中使用FreeType(2.5.2),但是在使用OpenWatcom时遇到了麻烦。make setup watcom像文档建议的那样运行无法正常运行,但仍会自动检测到Unix系统:
$ make setup watcom
FreeType build system -- automatic system detection
The following settings are used:
platform unix
compiler cc
configuration directory ./builds/unix
configuration rules ./builds/unix/unix.mk
If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.
Otherwise, simply type `make' again to build the library,
or `make refdoc' to build the API reference (the latter needs python). …Run Code Online (Sandbox Code Playgroud)