-> Int -> Int -> Int tarai x y z | x <= y = y | otherwise = tarai (tarai (x - 1) y z) (tarai (y - 1) z x) (tarai (z - 1) x y) main = do args <- getArgs let nums = map cv args where cv str = read str :: Int if length nums >= 3 then print (tarai (nums !! 0) (nums !! 1) (nums !! 2)) else print "illegal argument !!" // C #include <iostream> #include <cstdlib> int tarai(int x, int y, int z) { return x <= y ? y :tarai(tarai(x - 1, y, z), tarai(y - 1, z, x), tarai(z - 1, x, y) ); } int main(int argc, char* argv[]) { if (argc < 4) return 1; int x = std::atoi(argv[1]); int y = std::atoi(argv[2]); int z = std::atoi(argv[3]); std::cout << tarai(x, y, z) << std::endl; return 0; } ./tarai 20 10 0 # ऴΘΒͳ͍ ./tarai 20 10 0 # ऴΘΔ