Haskellã®Data.List#nubã¨ã Rubyã®Array#uniqã¯ãã©ã¡ãããªã¹ã/é åå ã®éè¤è¦ç´ ãåãé¤ããæ°ããé åãè¿ãé¢æ°ã§ãã ã©ããHaskellã®nubã¯Rubyã«æ¯ã¹ã¦ã ãã¶é ããªãã¨æãã¾ãã ãªã¹ãã¨é åã®ãã¼ã¿æ§é ã®éãã«èµ·å ããã®ã ããã¨æ³åã¯ã§ãã¾ããããã¾ãã¡è ã«è½ã¡ãªã*1ã®ã§ã¾ãã¯è¨æ¸¬ãè¡ãã¾ããã ã¾ãã¯ãéè¤ã®å ¨ããªãé·ããªã¹ã/é åã«ã¤ãã¦ã§ãã å ·ä½çã«ã¯ã1ãã100,000ã¾ã§ã®æ°å¤ãçªã£è¾¼ãã ãªã¹ã/é åã®éè¤ãåãé¤ãã¾ãã nub.hs module Main where import Data.List main = print $ length $ nub $ [1..100000] uniq.rb puts (1..100000).to_a.uniq.length è¨æ¸¬çµæ $ time ./nub 100000 re
{{#tags}}- {{label}}
{{/tags}}