Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Upload homework #2

wants to merge 6 commits into from

Conversation

IvoTod
Copy link

@IvoTod IvoTod commented Nov 1, 2016

No description provided.

Copy link
Contributor

@gcnew gcnew left a 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
Copy link
Contributor

@gcnew gcnew Nov 1, 2016

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
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant == True

@gcnew
Copy link
Contributor

gcnew commented Nov 1, 2016

Decode се нуждае от още малко любов:

пр:

decode "uou"
> "uou"

decode "oooo"
> "oooo"

@IvoTod
Copy link
Author

IvoTod commented Nov 1, 2016

Поизчистих кода но при мене decode си работи при тези случаи
screenshot from 2016-11-02 01 26 32
Използвам GHC v7.6.3

@g-nakov
Copy link
Contributor

g-nakov commented Nov 1, 2016

decode трябва ли да пипа гласните? Може да тестваш с decode (encode "uou") == "uou". Това винаги трябва да е вярно.

@IvoTod
Copy link
Author

IvoTod commented Nov 1, 2016

Оправих го, забравих че са гласни :D

@g-nakov
Copy link
Contributor

g-nakov commented Nov 2, 2016

👍
И като за последно (обещавам 😃 ) dropN 2 ('o':y:rest) е същотo като просто rest.

gcnew added a commit that referenced this pull request Nov 4, 2016
@IvoTod
Copy link
Author

IvoTod commented Nov 29, 2016

Качих домашните за пермутации и таблицата.
За таблицата не съм доимплементирал за разделителят между title и content редовете и не съм го пускал през тестовете (просто си го пробвах на table2 с putStr понеже ми се спи 😄 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants