-
Notifications
You must be signed in to change notification settings - Fork 7
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
Upload homework #2
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Като цяло Браво! Много ми хареса използването на стринга vowels
и isInString
|
||
|
||
isVowel :: Char -> Bool | ||
isVowel = undefined | ||
isVowel char | ||
| isInString (toLower char) vowels == True = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Няма нужда от guard, тъй като резултатният тип е Bool
, т.е.
isVowel char = isInString (toLower char) vowels
е еквивалентно :)
|
||
|
||
isConsonant :: Char -> Bool | ||
isConsonant = undefined | ||
isConsonant char | ||
| isVowel char == False && isChar char == True = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Няма нужда да сравняваш върнатия булев резултат с True
, тъй като:
True == True
е същото като True
, само че с повече тавтология. Ако искаме да обърнем резултата, обикновено ползваме не
(not
).
encode = undefined | ||
encode [] = [] | ||
encode (first:rest) | ||
| isConsonant first == True = first : 'o' : first : (encode rest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant == True
Decode се нуждае от още малко любов: пр: decode "uou"
> "uou"
decode "oooo"
> "oooo" |
|
Оправих го, забравих че са гласни :D |
👍 |
Качих домашните за пермутации и таблицата. |
No description provided.