我想开发一个代码(视觉工作室2012年)来控制一个移动机器人首先读取声纳传感器。 我创建了以下功能: void layer1(ArRobot *robot,ArSonarDevice *sonar)// this is the avoid front collision layer
{
double range=sonar->currentReadingPolar(-50.0,50.0
说我有一个功能: safeHead :: [a] -> Maybe a
safeHead [] = Nothing
safeHead xs = Just $ head xs
和测试: describe "Example.safeHead" $ do
it "returns the head" $ do
safeHead [1,2,3] `shouldBe` Just 1