小编G. *_*Zam的帖子

高阶函数haskell

我是Haskell的新手,我要做一个函数,使用高阶函数foldr计算字符串中元音的数量

我试过创建这个功能

vowels [] = 0
vowels (x:xs)= if elem x "aeiou" then 1 + vowels xs else vowels xs
Run Code Online (Sandbox Code Playgroud)

但它不起作用,我无法使用foldr任何建议吗?

string haskell fold higher-order-functions

4
推荐指数
1
解决办法
268
查看次数

标签 统计

fold ×1

haskell ×1

higher-order-functions ×1

string ×1