-
Haskell. Ammount of elements.
Hello!
I have to write a function in haskell that will count a number of elements in one word.
for example
in 'n' ('function')
out 2
I thought of something lke this
elemChar :: Char->String->Int
elemChar _ [] = 0
elemChar z (x:xs)
|z==x = 1 + elemChar z xs
|otherwise = elemChar z xs
but it shows me
<interactive>:1:15:
lexical error in string/character literal at character 'a'
what is the problem?
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks