8.2 Using Constraint Handling Rules
Here are the steps to be taken from writing to using CHRs:
-
Write a CHR program in a file
File
.chr
.
- In ECLiPSe, load the chr library with the query
lib(chr)
. It contains both the compiler and runtime system for
CHRs. Now ECLiPSe is in coroutining mode.
- Compile your
chr
file into a pl
file with the query
chr2pl(
File).
- In any ECLiPSe session, you can load a compiled constraint handler
(
[
File].
). The CHR library is automatically loaded
to provide the necessary runtime environment. ECLiPSe is in coroutining mode.
You can compile your chr
file and load the resulting pl
file
at once using the query chr(
File).