Skip to content

Instantly share code, notes, and snippets.

@veer66
Created February 13, 2023 07:48
Show Gist options
  • Save veer66/562380a7ad28167ebece953e7514c435 to your computer and use it in GitHub Desktop.
Save veer66/562380a7ad28167ebece953e7514c435 to your computer and use it in GitHub Desktop.
year(math, 60).
year(ai, 62).
year(english, 65).
str_rev(S, T) :- string_codes(S, SCODES), reverse(SCODES, TCODES), string_codes(T, TCODES).
can_register(STUDENT_ID, SUBJECT) :- str_rev(STUDENT_ID, REV_STUDENT_ID),
sub_string(REV_STUDENT_ID, 0, 2, _, REV_YEAR_STR),
str_rev(REV_YEAR_STR, YEAR_STR),
number_string(YEAR, YEAR_STR),
year(SUBJECT, REQ_YEAR),
YEAR =< REQ_YEAR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment