Skip to content

Instantly share code, notes, and snippets.

@GeoffChurch
Created October 17, 2022 16:38
Show Gist options
  • Save GeoffChurch/c5669eb67a8d2ccdfc911869338d6df3 to your computer and use it in GitHub Desktop.
Save GeoffChurch/c5669eb67a8d2ccdfc911869338d6df3 to your computer and use it in GitHub Desktop.
foldargs(Goal, A, B) -->
{ maplist(functor_arity_term_args(_, _), [A, B], [As, Bs]) },
foldl(Goal, As, Bs).
functor_arity_term_args(Functor, Arity, Term, Args) :-
functor(Term, Functor, Arity),
Term =.. [_|Args].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment