Skip to content

2013-4: Keeping Things In Balance

Write an APL dfn which returns a 1 if the opening and closing parentheses in a character vector are balanced, or a zero otherwise.

Examples:

      (your_function) '((2×3)+4)'
1
      (your_function) ''
1
      (your_function) 'hello world!'
1
      (your_function) ')(2×3)+4('
0
      (your_function) '(()'
0
      (your_function) ')'
0
your_function ←

Solutions

Video Thumbnail YouTube

Chat transcript Code on GitHub