ããµã¤ãã®Haskellããã°ã©ãã³ã°ã ã®ç¬¬3ç« ãåèã«ã㦠map é¢æ°ã mymap ã¨ããé¢æ°åã§ä½ã£ã¦ã¿ãã mymap é¢æ°ã®å¼æ°ã« square é¢æ°ã¨æ´æ°ã®ãªã¹ãã渡ãä¾ã®ã½ã¼ã¹ã³ã¼ãã $ cat ./mymap.hs main = print $ mymap square [1, 2, 3] square n = n * n mymap :: (a -> b) -> [a] -> [b] mymap f [] = [] mymap f (x:xs) = f x : mymap f xs å®è¡çµæã $ runghc ./mymap.hs [1,4,9] tags: haskell Posted by NI-Lab. (@nilab)
{{#tags}}- {{label}}
{{/tags}}