New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haskell要是改成这样就好了 by iwon #136

Open
freizl opened this Issue Apr 30, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@freizl
Member

freizl commented Apr 30, 2018

1.定义函数时的“=”前加个冒号":",方便区分参数和函数体。
如:
sum : : Int -> Int -> Int ->Int
sum a b c = a+b+c (好像是c=a+b+c)
改为:
sum : : Int -> Int -> Int ->Int
sum a b c := a+b+c
":" 表示函数参数结束,后面跟等号表示函数体开始

2.[2n | n<-[2,4,7],n>3] 改为:[ n<-[2,4,7],n>3 | 2n ] 或 [ [2,4,7]->n,n>3 | 2*n ] ,"|" 左边表示可输入的元素,右边表示输出
如:
addpairs : : [(Int, Int)] -> [Int]
addpairs pairList :=[ pairList->(m,n) , m<n | m+n ]

@freizl freizl added the migration label Apr 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment