Skip to content

passing predicates to a module predicate #1951

Answered by mvolkmann
mvolkmann asked this question in Q&A
Discussion options

You must be logged in to vote

@UWN Here is my latest version of the code I shared previously. See the questions in the TODO comments. Besides those questions, I'm interested in learning what else you would do differently in this code or what naming changes you recommend.

% This is in main.pl.
:- use_module(library(format)).
:- use_module(my_module).

% This converts a predicate to a namespaced goal
% so it can be passed to call_goals.
:- meta_predicate(predicate_goal(1, -)).
% TODO: The rules "first" and "second" take two arguments,
% TODO: so why can't I use the next line in place of the previous one?
% :- meta_predicate(predicate_goal(2, -, -)).

% TODO: Is there a better name for this?
predicate_goal(G_1, G_1).

first

Replies: 3 comments 17 replies

Comment options

You must be logged in to vote
14 replies
@UWN
Comment options

@mvolkmann
Comment options

@UWN
Comment options

@mvolkmann
Comment options

Answer selected by mvolkmann
@UWN
Comment options

@mvolkmann
Comment options

@UWN
Comment options

Comment options

You must be logged in to vote
3 replies
@mvolkmann
Comment options

@pmoura
Comment options

@mvolkmann
Comment options

Comment options

You must be logged in to vote
0 replies
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