这几天的sicp第三章快结束了,可是stream这边,我始终无法在drscheme中使用,因此在google大神的帮助下,找到了解决方法; 原文在这里: http://schemewiki.org/view/Cookbook/MiscSICP 要在drscheme中使用stream,必须在代码中加入下面这部分: (require (lib "defmacro.ss")) ; cons-stream : obj stream -> stream ; construct a stream whose first element is obj and whose tail is s ...
-->代表输出 1 简单类型,比如: :t 'c' --> 'c'::Char :t "as" --> "as"::String 这些都很简单,大家一目了然。 在haskell中,内置的basic type有下面几种 引用 Bool,Char,String,int,Integer,Float int和integer的区别就是 int是有限制的比如 int值的范围是 -2^31----2^31-1.而在Integer中他是可以避免大小的限制的,比如2^31::Integer他会给出正确的值。 2 List类型 一个list的类型就是他所包含的元素的类型。比如: :t [Flas ...
SICP Exercise 1.22 (define (timed-prime-test n) (newline) (display n) (start-prime-test n (runtime))) (define (start-prime-test n start-time) (if (prime? n) (report-prime (- (runtime) start-time)))) (define (report-prime elapsed-time) (display " *** ") ( ...
The Perils of JavaSchools http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html 我们的那些大学真该反思下CS的教育. 这句写得很好 : 引用CS is proofs (recursion), algorithms (recursion), languages (lambda calculus), operating systems (pointers), compilers (lambda calculus) -- and so the bottom line is that a ...
书里面用的是huge我用的是GHC 1 首先到 http://haskell.org/ghc/ 这边去下载个haskell的 编译器。 如果不习惯emacs的话可以到这里 去下个 eclipse的插件,不过要注意这个插件只支持jdk5.0. 2 haskell 中有+ - * / ^ 和 `div` (这个是只取整数部分,比如 5 'div'3 输出 1 其他的符号就不用解释了。 这边要注意一些算符优先级, 比如2*3^4 相当于 2*(3^4) ,而2^3^4相当于 2^(3^4)。 3 haskell中还有很多操作list的操作。 (1) 选择一个非空li ...
simohayha
搜索本博客
存档
最新评论