Meta_predicate in Options?

I don’t think this is possible, but would like to check anyway…

I have something like this:

:- meta_predicate search(2, 1, ?, ?, +).
search(GetChildren, Goal, Origin, Destination, Options) :-

But this is verbose and putting un-intuitive arguments up front. What I’d like is something like this:

:- meta_predicate search(?, ?, [2, 1|+]).
search(Origin, Destination, Options) :-
    member(get_children(GetChildren), Options),
    member(goal(Goal), Options),

Is there some way to get a module sensitive argument from a list of options?

(Actual source code is public on GitLab: generic search algorithms to save some coding time for common problems)

1 Like

Hi Paul,

You probably already know this, but on that page and URL, you have a typo for “algorithms”:


Whoops! New keyboard syndrome…

See meta_options/3. I’m no really enthusiastic about goals in options. And I think it is not natural to use options for things that are obligatory. If you give the actual predicate you use to get children and validate the target sensible names I see little wrong with search/5.

1 Like