I was wondering... In the standard library of some Prolog systems, there are meta-predicates like
In general, when using meta-predicates (like the ones above) with dcg we always need the "foldl" variants. What about the following
mapfoldl(P_4,Xs,Zs,S0,S) :- list_mapfoldl_(Xs,Zs,S0,S,P_4). list_mapfoldl_(,,S,S,_). list_mapfoldl_([X|Xs],[Y|Ys],S0,S,P_4) :- call(P_4,X,Y,S0,S1), list_mapfoldl_(Xs,Ys,S1,S,P_4).
What's your take on this code? They isn't this (or something very similar) already in the stdlibs?