Skip to content

Need help splitting out a utility module [AOC day 2 spoilers] #2193

Answered by aarroyoc
librarianmage asked this question in Q&A
Discussion options

You must be logged in to vote

You need to add:

:- meta_predicate parse_lines(:, ?, ?, ?).

after the module declaration in util.prolog. This is required because otherwise the parse_lines//2 predicate receives just an atom that cannot resolve, because we're not importing the day02 module in util. Modules are like namespaces, so in order to see it, we need to attach the module name in front of the predicate. :- meta_predicate allows us to let the Prolog system do that for us for a specific argument in a call.

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@librarianmage
Comment options

Answer selected by librarianmage
Comment options

You must be logged in to vote
1 reply
@librarianmage
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants