As I understand it, the only slight inelegance with swi-prolog’s append/3 currently is the unwanted choicepoint when args 2 & 3 are lists, and arg 1 is var. This solves that issue, with a reasonable performance hit:
append2a(Start, End, Both) :-
% Guard against unwanted choicepoint
is_list(Both),
is_list(End),
!,
append(Start, End, Both),
!.
append2a(Start, End, Both) :-
append(Start, End, Both).
I don’t see a need to check the first arg.
Edit: Tweaked to check Both
then End
vars, which seems like a slightly more sensible order, for performance/likelihood.
This is basically what jan already wrote above. I don’t see a better way.