Skip to content

Upload homework#2

Open
IvoTod wants to merge 6 commits intoelsys:masterfrom
IvoTod:master
Open

Upload homework#2
IvoTod wants to merge 6 commits intoelsys:masterfrom
IvoTod:master

Conversation

@IvoTod
Copy link
Copy Markdown

@IvoTod IvoTod commented Nov 1, 2016

No description provided.

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

Comment thread exercises/secret-lang/Secret-lang.hs Outdated
isVowel :: Char -> Bool
isVowel = undefined
isVowel char
| isInString (toLower char) vowels == True = True
Copy link
Copy Markdown
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

е еквивалентно :)

Comment thread exercises/secret-lang/Secret-lang.hs Outdated
isConsonant :: Char -> Bool
isConsonant = undefined
isConsonant char
| isVowel char == False && isChar char == True = True
Copy link
Copy Markdown
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).

Comment thread exercises/secret-lang/Secret-lang.hs Outdated
encode = undefined
encode [] = []
encode (first:rest)
| isConsonant first == True = first : 'o' : first : (encode rest)
Copy link
Copy Markdown
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
Copy Markdown
Contributor

gcnew commented Nov 1, 2016

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

пр:

decode "uou"
> "uou"

decode "oooo"
> "oooo"

@IvoTod
Copy link
Copy Markdown
Author

IvoTod commented Nov 1, 2016

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

@g-nakov
Copy link
Copy Markdown
Contributor

g-nakov commented Nov 1, 2016

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

@IvoTod
Copy link
Copy Markdown
Author

IvoTod commented Nov 1, 2016

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

@g-nakov
Copy link
Copy Markdown
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
Copy Markdown
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.

3 participants