frege module Utils where data Point = Point Int Int distance :: Point -> Point -> Double distance (Point x1 y1) (Point x2 y2) = sqrt (fromIntegral ((x2 - x1) ^ 2 + (y2 - y1) ^ 2)) frege module Main where import Utils main :: IO () main = do let p1 = Point 0 0 p2 = Point 3 4 print (distance p1 p2) fregec -d bin Utils.fr fregec -d bin Main.fr java -cp bin Main


上一篇:
下一篇:
切换中文