Need help splitting out a utility module [AOC day 2 spoilers] #2193
-
Hi, I am working on making a utility module for my Advent of Code scripts, but while everything works when I keep it all in one file, splitting it out gives me the following error:
Am I misunderstanding things? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
It appears that |
Beta Was this translation helpful? Give feedback.
-
You need to add:
after the module declaration in |
Beta Was this translation helpful? Give feedback.
-
Thank you a lot for posting this! It is nice to see the first instances of One small thing I noticed in the code: Maybe the predicate ?- #=(#X, 1, T). T = false, clpz:(X in inf..0\/2..sup) ; X = 1, T = true. Thanks to your example, I noticed that |
Beta Was this translation helpful? Give feedback.
You need to add:
after the module declaration in
util.prolog
. This is required because otherwise theparse_lines//2
predicate receives just an atom that cannot resolve, because we're not importing theday02
module inutil
. 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.