{"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Finaz2.hatenablog.com%2Fentry%2F2013%2F05%2F03%2F204810\" title=\" List\u30e2\u30ca\u30c9\u3067\u975e\u6c7a\u5b9a\u6027\u8a08\u7b97 - \u3082\u3082\u3044\u308d\u30c6\u30af\u30ce\u30ed\u30b8\u30fc\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","image_url":null,"url":"https://inaz2.hatenablog.com/entry/2013/05/03/204810","blog_title":"\u3082\u3082\u3044\u308d\u30c6\u30af\u30ce\u30ed\u30b8\u30fc","published":"2013-05-03 20:48:10","width":"100%","type":"rich","author_name":"inaz2","height":"190","categories":["Haskell"],"version":"1.0","provider_url":"https://hatena.blog","provider_name":"Hatena Blog","description":"List\u30e2\u30ca\u30c9\u3092\u4f7f\u3046\u3068\u3001SICP\u306eamb\u8a55\u4fa1\u5668\u304c\u884c\u3046\u3088\u3046\u306a\u975e\u6c7a\u5b9a\u6027\u8a08\u7b97\u304c\u3067\u304d\u308b\u3002 \u305f\u3068\u3048\u3070\u3001\u30d4\u30bf\u30b4\u30e9\u30b9\u6570\u3092\u5217\u6319\u3059\u308b\u30b3\u30fc\u30c9\u306f\u6b21\u306e\u3088\u3046\u306b\u66f8\u3051\u308b\u3002 -- ptriples.hs import Control.Monad -- guard\u95a2\u6570\u3092\u4f7f\u3046\u305f\u3081 ptriples = do a <- [1..] b <- [1..a] -- b <= a c <- [a..a+b] -- c \u3092\u659c\u8fba\u3068\u3059\u308c\u3070 a <= c \u304b\u3064\u4e09\u89d2\u4e0d\u7b49\u5f0f\u3088\u308a c <= a+b guard (a*a + b*b == c*c) return (b,a,c) -- \u5c0f\u3055\u3044\u6570\u304b\u3089\u4e26\u3079\u308b main = mapM_ print ptrip\u2026","title":" List\u30e2\u30ca\u30c9\u3067\u975e\u6c7a\u5b9a\u6027\u8a08\u7b97","blog_url":"https://inaz2.hatenablog.com/","author_url":"https://blog.hatena.ne.jp/inaz2/"}