Skip to content

Bracket balance is ready#7

Open
viktoriia-fomina wants to merge 4 commits into
masterfrom
bracketBalance
Open

Bracket balance is ready#7
viktoriia-fomina wants to merge 4 commits into
masterfrom
bracketBalance

Conversation

@viktoriia-fomina
Copy link
Copy Markdown
Owner

No description provided.

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

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

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