haskell大神,求问一道Haskell的编程题!原题是英文,我怕我翻译不到位,还是把题目po上来:Define a function called 'SquareSum' that sums the squares of a list of integers.Give the type of the function and use an anonymous funct
来源:学生作业学帮网 编辑:学帮网 时间:2024/05/31 10:51:50
haskell大神,求问一道Haskell的编程题!
原题是英文,我怕我翻译不到位,还是把题目po上来:Define a function called 'SquareSum' that sums the squares of a list of integers.Give the type of the function and use an anonymous function and the library functions 'foldr' and ' map',but no other library functions.
意思是:定义一个函数 取名为SquareSum,将一个list的整数平方后,再都加起来算和,给出函数的类型type,并且使用使用一个匿名函数和库函数‘foldr’和’map‘,但不能使用其它库函数.
这个问题不成立, 因为(+)也是库函数 (不知道你敢不敢这样告诉你老师)
不敢的话就只好乖乖写
squaresum :: [Integer] -> Integer
squaresum nums = foldr (+) 0 (map (^ 2) nums)
haskell大神,求问一道Haskell的编程题!原题是英文,我怕我翻译不到位,还是把题目po上来:Define a function called 'SquareSum' that sums the squares of a list of integers.Give the type of the function and use an anonymous funct
求问一道Haskell题目,是一道英文题目,我害怕翻译不到位,还是把原题po上来了:Give the type and definition for a funtion called 'matches' that take an element and a list where the element is of the same type as the elements in
求高中数学大神!问一道题,谢谢了!
编程 haskell
问数学大神一道高等数学求定积分的题目,谢谢求具体过程,感激不尽~~
问一道三角函数题,求大神指教,第一道题,求这个式子的最小值,x的范围是(0,90°),求大神赐教,
问各位英语大神一道完成对话,
一道数学题, 求大神帮化简.
一道英语题求大神
一道高数题,求大神解决~
一道物理题!求大神进
一道英语选择题~求大神
一道初中数学题,求大神
大神求第一道,理由!
一道解析几何题目.求大神
一道选择题求大神帮忙
一道应用题求大神解
一道难题,求大神解答!