
SICP in Haskell
文章平均质量分 73
iteye_14880
这个作者很懒,什么都没留下…
展开
-
Section 1.1
1.1 略 1.2 略 1.3 sumSLT :: (Num a,Ord a) => a -> a -> a -> a sumSLT a b c | (a<b && a<c) = b*b + c*c | (b<a && b<c) = a*a + c*c | otherwise = a*a +...2008-11-17 16:13:08 · 125 阅读 · 0 评论 -
Section 1.2
1.9 略 1.10 略 1.11 {- recursive style f3' n | n<3 = n | otherwise = f3(n-1) + 2*f3(n-2) + 3*f3(n-3) -} getBegin n = n-(fromIntegral t)-1 where t = floor (n-3) ::Integer f3 n |...2008-11-17 16:13:32 · 102 阅读 · 0 评论 -
Section 1.3
1.29 cube :: Double -> Double cube x = x*x*x getSum term a next b = if a>b then 0 else term a + getSum term (next a) next b simpsonIntegral :: (Double -> Double) -> Double -> Double...2008-11-17 16:14:02 · 95 阅读 · 0 评论 -
SICP 第一章小结
--包括一些摘录和感言,和零碎的代码 1、要素 写道 Every powerful language has three mechanisms for accomplishing this: * primitive expressions , which represent the simplest entities the language is concerned with,...原创 2008-11-18 16:06:23 · 164 阅读 · 0 评论 -
Section 2.1
2.1 {-data Ration x = R Integer Integer instance (Show a) => Show (Ration a) where showsPrec _ (R n d) = shows (n `div` g).showString " % ". shows (d `div` g) where g = gcd' n d ...2008-11-19 23:27:39 · 95 阅读 · 0 评论 -
Section 2.2
2.17 {- Prelude.last -- | Extract the last element of a list, which must be finite and non-empty. last :: [a] -&...2008-11-21 12:25:13 · 117 阅读 · 0 评论