Skip to content

Commit

Permalink
Simnplify
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Mar 8, 2024
1 parent a59e59a commit f3f1956
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
:- use_module(library(dcg/basics)).
:- set_prolog_flag(double_quotes, chars).

parentheses --> "(", balanced, ")".
brackets --> "[", balanced, "]".
Expand All @@ -8,9 +9,9 @@
balanced --> non_bracket, balanced.
balanced --> [].

non_bracket --> [C], { string_codes("()[]{}", Codes), \+ member(C, Codes) }.
non_bracket --> [C], { \+ member(C, "()[]{}") }.

paired(String) :-
string_codes(String, Codes),
phrase(balanced, Codes),
string_chars(String, Chars),
phrase(balanced, Chars),
!.

0 comments on commit f3f1956

Please sign in to comment.