While working on error messages for the DCG translator,
I found a little easter egg. This here seems to work in SWI-Prolog:
:- set_prolog_flag(double_quotes, codes).
p([H|T]) --> [H|T], "s".
A query works as expected, and the open list seems to be translated to ‘$append’/3:
?- p(X, "abcs", "").
X = [97, 98, 99] ;
false.
?- listing(p/3).
p([A|B], C, D) :-
'$append'([A|B], E, C),
E=[115|D].
I expected it is undocumented? It can give an alternative to (…)/2 from here:
:- use_module(library(pio)).
... --> []|[_], ... .