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

Bracket balance is ready #7

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

Conversation

viktoriia-fomina
Copy link
Owner

No description provided.

@viktoriia-fomina viktoriia-fomina changed the title Bracket balance are ready Bracket balance is ready May 25, 2020
Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

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

Окей, зачтена

Comment on lines +5 to +15
let isBracket symbol = List.contains symbol ['('; ')'; '['; ']'; '{'; '}']

let isOpeningBracket symbol = List.contains symbol ['('; '['; '{']

let isClosingBracket symbol = List.contains symbol [')'; ']'; '}']

let pairIsBalanced bracket1 bracket2 =
if List.contains bracket1 ['('; ')'] && List.contains bracket2 ['('; ')'] then true
elif List.contains bracket1 ['['; ']'] && List.contains bracket2 ['['; ']'] then true
elif List.contains bracket1 ['{'; '}'] && List.contains bracket2 ['{'; '}'] then true
else false

Choose a reason for hiding this comment

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

Можно было в Map сложить и делать это немного проще :)

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.

2 participants