对本文有疑问可联系个人邮箱liangjd@163.com或加v:TutorFor100
Haskell is a purely functional programming language. In imperative languages you get things done by giving the computer a sequence of tasks and then it executes them. While executing them, it can change state.
If you feel haskell is hard , please contact me , I can help you learn all content easily in this course.
CS4620 University College Cork
Course Description:Problem solving emphasizing recursion, data abstraction, and higher-order functions. Introduction to types and type checking, modular programming, and reasoning about program correctness.
本课程学习函数式编程语言Haskell
1.Lambda Calculus
2.Datatypes and Recursion
3.Higher-order functions
4.Polymorphism and type inference
5.Typeclasses
6.Monads
– calc (n + n+1 + … + n+7 ) for the given n
strangeSummation :: Integer -> Integer
strangeSummation n = sum ([n…(n+7)])
– rewrite preclude function [n…m]
range :: Integer -> Integer -> [Integer]
range m n
| m > n = []
| m == n = [m]
| m < n = m : range (succ m) n
– rewrite function last
mylast :: [a] -> a
mylast xs = head $ reverse xs
mylastb :: [a] -> a
mylastb xs = head $ drop (length xs - 1) xs