Skip to content

Instantly share code, notes, and snippets.

@kowey
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kowey/ddfa95ea58b0db3a582c to your computer and use it in GitHub Desktop.
Save kowey/ddfa95ea58b0db3a582c to your computer and use it in GitHub Desktop.
% `Debug:<trace path...>` is meant to work as functionally
% a drop-in replacement for `path...`, except that it also
% prints it out to stderr.
% This can be useful if you want to avoid recomputing
% the local path (for example, if it's stateful and you want
% to avoid changing the meaning of the code)
'Debug'([trace|P], GN, GP, P) :- 'Debug'([writeline|P], GN, GP, []).
% `Debug:<writeline>` sends its output to stderr, so that you can
% avoid confusing it up with any actual output you may want to
% produce
'Debug'([writeline|P], GN, GP, []) :- !,
with_output_to(user_error, 'System'([writeline|P], GN, GP, [])).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment