-- Simple implementation of reverse function -- using recursion -- import System.Environment rev [] = [] rev (x:xs) = rev xs ++ [ x ] main = do args <- getArgs let n = read (args !! 0):: Int in do putStr "n = " print n -- only ask for the first item putStr "head = " print ( head ( rev [1..n] ) )