2010-01-01ãã1å¹´éã®è¨äºä¸è¦§
ãã£ããããæ°åã¯ãèªç¶çã«ç¾ããåç´ã«ãã¦åºæ¬çãªæ°åã§ããããã¨ãã°ãããã¯ãªã®ç¨®ã®ä¸¦ã³ãããããã®å®¶ç³»å³ã¯ãã£ããããæ°åãæãã å帰 ãã£ããããæ°åã®æ¼¸åå¼ããã®ã¾ã¾ Haskell ã§å®è£ ããã¨ä»¥ä¸ã®ããã«ãªãã fib :: Int -> Integer fâ¦
Applicativeã¹ã¿ã¤ã«ã®ä¸è¬çãªå½¢ã¯ã以ä¸ã®ããã«ãªãã f <$> m1 <*> m2 <*> m3 ... 㯠liftM (ããã㯠fmap)ã®å¥åãap 㯠ã®å¥åã ã¨æã£ã¦ãããap ã®å®è£ ãè¦ã¦ã¿ãã¨ã以ä¸ã®ããã«å®ç¾©ãã¦ããã ap :: (Monad m) => m (a -> b) -> m a -> m b ap =â¦
ãã£ããããæ°åãæ±é¢æ°ã§æ¸ãã fib :: (Integer -> Integer) -> Integer -> Integer fib _ 0 = 0 fib _ 1 = 1 fib f n = f (n-1) + f (n-2) ããã¦ãä¸åç¹ã³ã³ããã¼ã¿ãé 延è©ä¾¡ãæ´»ããã¦ä»¥ä¸ã®ããã«å®ç¾©ããã(Control.Monad.Fix ã import ãã¦ã â¦
ãã®è¨äºã®ç®çã¯ãApplicative ä¿¡è ã«ãã Applicative ã¹ã¿ã¤ã«ã®å¸æã§ããç°¡æ½ã«çµè«ãè¿°ã¹ãã¨ã foo = do a <- m1 b <- m2 return (f a b) ã®ãããªã³ã¼ããæ¸ããããªã£ãã foo = f <$> m1 <*> m2 ã¨æ¸ãã¾ãããã¨ãããã¨ãåãè¨èã¯ããdo 㨠reâ¦
GHC 7.0.1ããªãªã¼ã¹ããã¾ããããããããã®ãã¼ã¸ã«ãæ¸ãã¦ããããã«ãcabal-install ãå¤ãã¨ãã¤ããªããã±ã¼ã¸ã®ã¤ã³ã¹ãã¼ã«ã¯å¤±æãã¾ããã§ããèªåã§ãã«ãããã°ãããªããã¤ã³ã¹ãã¼ã«ãã¦ãã cabal-install ã¯ä½¿ããªãã®ã§ã大ä¸å¤«ã§ãããâ¦
注ï¼ãã®è¨äºã®å 容ã«ã¯ãåé¡ããããããªã®ã§ãåå¼·ãã¦æ¸ãç´ãäºå®ã§ããã²ã¼ãã«ã®ä¸å®å ¨æ§å®çãèªãã§ãç解ã§ããªã Lisper ã®ããã«ãLisp ã®ã³ã¼ãã§ä¸å®å ¨æ§å®çã説æãã¦ã¿ããæ¨æ¥ã¨åæ§ã« Emacs Lisp ã使ãããCommon Lisp ã Scheme ã§ãã³â¦
åæ¢æ§åé¡ãèªãã§ããæå³ãåãããªãã£ã Lisper ã®ããã«ãLisp ã®ã³ã¼ãã§åæ¢æ§ã解説ãã¦ã¿ãã使ç¨ãã Lisp ã¨ãã¦ã¯ãSchemeãCommon LispãEmacs Lisp ãæ¤è¨ããããEmacs Lisp ãä¸çªããã¨åãã£ãã®ã§ãEmacs Lisp ã使ãã ååã使ã£ãæ¦â¦
以ä¸ã¯ Alice ãå®ç¾©ï¼ {-# LANGUAGE TypeSynonymInstances #-} module A where type StackA = [] top :: StackA a -> a top = head pop :: StackA a -> StackA a pop = tail push :: a -> StackA a -> StackA a push = (:) move :: StackA a -> c a -> (a -â¦
{-# LANGUAGE TypeSynonymInstances #-} -- 以ä¸ã¯ Alice ãå®ç¾© type StackA = [] topA :: StackA a -> a topA = head popA :: StackA a -> StackA a popA = tail pushA :: a -> StackA a -> StackA a pushA = (:) -- 以ä¸ã¯ Bob ãå®ç¾© data StackB a = Niâ¦
ããã°ã©ãã³ã°ã®çµé¨ã¯ããããHaskell ã¯ä½¿ã£ããã¨ããªã人ã«ã2æéããã㧠Haskell ã®ãããæããæ¼ç¿ã®ãã¿ãèãããHaskell ã®ä»£è¡¨çãªå©ç¹ã¨ããã°ã åã«ããå³å¯ãªããã°ã©ãã³ã° QuickCheck ã«ãããã¹ãã±ã¼ã¹ã®èªåçæ Persec ã«ãããã¼ãµâ¦
ç¨æãã¹ããã®ï¼ git ãã±ã¼ã¸å㯠git-core ãã ãã¸ã¥ã¢ã©ã¤ã¶ã¼ BSD/Linux ãªã gitkãMac ãªã GitX github ã®ã¢ã«ã¦ã³ã ä»åã¯ãèªå㧠git ãµã¼ãã¼ãä¸ãããã¨ã¯ãã¾ãã ç°å¢è¨å® git config --global user.name "åå" git config --global useâ¦
ãã§ããï¼ ãScheme æç¿ããã復å»ãã¾ãããæ£ç¢ºã«è¨ãã¨ã復å»ã§ã¯ãªããæ°ããçã«åºã¥ããæ°ãã訳ã§ããSchemeæç¿ãä½è : Daniel P. Friedman,Matthias Felleisen,å åæç·,横山æ¶ä¸åºç社/ã¡ã¼ã«ã¼: ãªã¼ã 社çºå£²æ¥: 2010/10/22ã¡ãã£ã¢: åè¡æ¬ï¼â¦
Visual Git Reference ã訳ãã¾ããããã®åãå³è§£Gitã§ããèè ã® Mark Lodato ããã«é£çµ¡ããããgithub 㧠fork ãã¦è¨³ãå ¬éãã¦ä¸ããã¨è¨ãããã®ã§ããããããæ¬å®¶ã«ãã¼ã¸ããã¦ãå³ä¸ã«è¨èªã¡ãã¥ã¼ã¾ã§ä»ãã¾ããã:) Git ã github ã¯ã使ã£ã¦ãâ¦
ãã¨ãã° SSH ã PGP ã®éµå¯¾ãçæããã¨ãã«ã¯ãæ¬å½ã®ä¹±æ°ãå¿ è¦ã«ãªããç似乱æ°ã§ã¯ãã¡ã ãUnix ä¸ã§ä¹±æ°ãçæãã¦ãããããã¤ã¹ã¨ãã¦ã¯ã/dev/ramdom ãããã/dev/ramdom ã«ã¯ãçæ§ä¹±æ°ãèãããã¦ãã¦ãread ã·ã¹ãã ã³ã¼ã«ã§å¿ è¦ãªãã¤ãæ°ã â¦
State ã¢ããã¨ç似乱æ°ã§æ¸ããããã«ãé 延è©ä¾¡ãå©ç¨ã§ããè¨èªã§ã¯ãç¡éæ°åãæ±ããã®ã§ãç似乱æ°ã使ãéã«ç¶æ ãæããªãã¦ãããããã®ä¸ä¾ã¨ãã¦ãã¢ã³ãã«ã«ãæ³ã«ããåå¨çã®è¿ä¼¼ãæãã¦ã¿ããXY å¹³é¢ã«åä½åãèããã radius :: Double raâ¦
Haskell ã§æ£è¦è¡¨ç¾ã使ããããªã£ãã¨ãã¾ããHaskell ã«ã¯æ£è¦è¡¨ç¾ã®ãªãã©ã«ããªãã®ã§ãæååãªãã©ã«ã§ä»£ç¨ãã¾ããHaskell ã®æ£è¦è¡¨ç¾ã§ã¯ãã¡ã¿æåã®å¤ããããã¯ã¹ã©ãã·ã¥ã使ããã«å®ç¾©ããã¦ãã¾ããããã§ãæååä¸ã«ããã¯ã¹ã©ãã·ã¥ãæ¸ãâ¦
Real World Haskell èªæ¸ä¼ã§ã® Maybe ã¢ããã«é¢ããè°è«ãã¾ã¨ãã¦ããã¾ãã case 㨠Maybe ã¢ããã®å°å ¥ã«ã¯ãå¿ ãã¨ãã£ã¦ããã»ã©ãMaybe ã使ããã¾ãããã¨ãã°ãåä¾ããã¼ã¨ãã¦æ¤ç´¢ããã¨ãç¶è¦ªãå¾ããã DB ãããã¨ãã¾ãã type DB = [(Strinâ¦
Haskell åå¿è ã¯æ¬å¼§ã°ããã® Lisp ã®ãããªã³ã¼ããæ¸ããä¸ç´è ã«ãªãã¨ã($) ãå¤ããªããä¸ç´è (è¨ãéããï¼)ã«ãªãã¨ã($) ãæ¶ãã¦ã(.) ãå¤ããªãããã®è¨äºã§ã¯ãä¸ç´è ã«ãªãã³ããã¡ãã£ã¨æãã¡ãããã æ¬å¼§ã ããã®ã³ã¼ã ã§ã¯ã以ä¸ã®ä¾ã«â¦
SenderID/SPF ã«å ãã¦ãDomainKeys/DKIM ãå®è£ ãã RPF ããªãªã¼ã¹ãã¾ããã èæ¯ ã¡ã¼ã«ã¢ãã¬ã¹ã®è©ç§°ãå¤æã§ãããããããã¡ã¤ã³èªè¨¼ã«ã¯ãIP ãã¼ã¹ã¨ç½²åãã¼ã¹ã®2種é¡ããããããããã«é·æçæãããã¾ãã IP ãã¼ã¹ Sender ID/SPF 転éã«å¼±ãâ¦
Haskell ã®åªé ãã示ãããã«ãã使ãããã³ã¼ãã¯ãåªé ãã¨åãããããã ãã«ç¹åãã¦ãããç¾å®çã«ã¯é ããã¨ãå¤ããæ¸ãæã¯ä»ã«å¹çã®ããå®è£ ããããã¨ãç¥ã£ã¦ããã®ã ããã©ãèªã¿æã¯ããã§ã¯ãªããããå¾ã§å¹çãæªãã¨æ°ã¥ãã¦æç¶ã¨ããã¿â¦
ã¬ãã¥ã¼ã«åå ãããé¢æ°ããã°ã©ãã³ã°ã®æ¥½ãã¿ããå±ãã¾ãããããã¯ãé¢æ°ããã°ã©ãã³ã°ã®å ¥éæ¸ãããã¤ãèªãã 人ãããã£ã¨é«ã¿ãç®æãããã®æ¬ã§ããé¢æ°ããã°ã©ãã³ã°ã®æ¥½ãã¿ä½è : ï¼ªï½ ï½ï½ ï½ï½ Gï½ï½ï½ï½ï½ï½ ï½ï½ï½ ï¼¯ï½ ï½ï½ ï½ï½ ï¼ï½ï½ï½â¦
twitter ã§ç¶ãã¦ãã Haskell ã¨å¯ä½ç¨ãããã³åç §éææ§ã®è°è«ã§ãããtwitter ã§ã¯ã³ã¼ãã示ãã«ããã®ã§ãããã°ã«æ¸ãã¾ããããã«å¯¾ããè¿çã¯ãtwitter ã§ãæ§ãã¾ããããããã°ã«å¯¾ããã³ã¡ã³ãã§ãããã§ããããã©ãã¯ããã¯ã§ã OK ã§ããå¤ãâ¦
ä¸åç¹ é¢æ° f :: a -> a ã«å¯¾ãã¦ãf x == x ã¨ãªã x ããé¢æ° f ã®ä¸åç¹ãã¨ããããããé¢æ° f ãå ¥åã¨ãã¦åããé¢æ° f ã®ä¸åç¹ãè¿ãé¢æ° Y ãããã¨ããã°ãé¢æ° f ã®ä¸åç¹ã Y f ã¨è¡¨ç¾ã§ãããããã§ãY ã®åã調ã¹ããå¼æ° f ã®å㯠a -> aãYâ¦
Data.Sequence ã§ä½¿ããã¦ãã FingerTree ã®æ§é ã調ã¹ã¦ãã¦ãå¤ç¸å帰åãåãã¦ç¥ã£ããåãæãã¤ãæãç°¡åãªä¾ã¯ããã data Bin a = Bin a a deriving Show data List a = Nil | Cons a (List (Bin a)) deriving Show ãããã風ã«ä½¿ãã â Nil Nil â¦
ST ã¢ããã®ä¸ã§ã¯ãé åã«å¯¾ãã¦ç ´å£çãªæä½ãã§ããã®ã§ã試ãã«ãã¼ãã½ã¼ããä½ã£ã¦ã¿ã¾ããããã¼ãã½ã¼ãã®ã¢ã«ã´ãªãºã ã¯ããç çã®ããã°ã©ãã³ã°ããåèã«ãã¾ããã > x <- randomArray 10 100 > x array (1,10) [(1,71),(2,27),(3,85),(4,6),(5â¦
Haskell ã®ãªã¹ãã¯ã¢ããã§ãããããã¯é決å®æ§ã®æèã表ãã¨è¨ããã¾ãããããããã®ãã¨ãæ±ã£ãä¾é¡ã¯å°ãªãã¦ããããã¤ãã¤ãã§ãããããã§ãScheme ã§æ¸ãããããä¾é¡ã Haskell ã§æ¸ãç´ãã¦ã¿ã¾ããããOn Lispãã®ãé決å®æ§ãã®ç« ã§ã¯ãè¬ãâ¦
The Typeclassopediaã«ã¯ã以ä¸ã®ãããªæç« ãããã¾ãã çµå±ãããããèªå¤§åºåã«ãããããããMonadã¯åãªãåã¯ã©ã¹ã«éãã¾ããã ã¾ããThe Trivial Monadã§ã¯ã以ä¸ã®ããã«è¿°ã¹ããã¦ãã¾ãã Haskell ã® Monad ã¯åã¯ã©ã¹ã®1ã¤ã§ããHaskell ã®åâ¦
Applicative ããã Monad ã®æ¹ãåãå¼·ãçç±ãèããããã®ã¡ã¢ãããããè°è«ããããã®ãããå°ãªã®ã§ãããæã£ã¦èªãã§æ¬²ããã ã³ã³ããã§å ã return Monad ã¨ã¯ãã³ã³ããã§ãããã³ã³ããã¯ãæèã表ãããã¨ãã°ãMaybe ã¨ããã³ã³ããã¯ã失æâ¦
SICP ã®å³å½¢è¨èªã Haskell ã§æ¸ãã¦ãã¦ãæå¾ã« draw-line ãæªå®ç¾©ã«ãªã£ã¦ãããã¨ã«æ°ä»ããåãããã«ãªãã¾ãããå³å½¢è¨èªãªã®ã«ãçµµãæããªããããï¼ãããããªãã¨ãè¸ã¿ã¨ã©ã¾ã£ã¦å®æããã¾ããã誰ãã®å½¹ã«ç«ã¤ãããããªãã®ã§ãå ¬éãã¦ããâ¦