我想開發一個代碼(視覺工作室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