我是Haskell的新手,我要做一个函数,使用高阶函数foldr计算字符串中元音的数量
我试过创建这个功能
vowels [] = 0 vowels (x:xs)= if elem x "aeiou" then 1 + vowels xs else vowels xs
但它不起作用,我无法使用foldr任何建议吗?
foldr
string haskell fold higher-order-functions
fold ×1
haskell ×1
higher-order-functions ×1
string ×1