Skip to content

Instantly share code, notes, and snippets.

@vituscze
Created March 11, 2026 12:16
Show Gist options
  • Select an option

  • Save vituscze/446bf46cdb62bb5bb764fdd2c3335ca0 to your computer and use it in GitHub Desktop.

Select an option

Save vituscze/446bf46cdb62bb5bb764fdd2c3335ca0 to your computer and use it in GitHub Desktop.
sublist(L, M) :-
M = [_|_],
append(_, Suffix, L),
append(M, _, Suffix).
subseq([], []).
subseq([X|L], [X|M]) :- subseq(L, M).
subseq([_|L], M) :- subseq(L, M).
disjoint([], [], []).
disjoint([X|L], [X|M], N) :- disjoint(L, M, N).
disjoint([X|L], M, [X|N]) :- disjoint(L, M, N).
rotate([], []).
rotate(L, M) :- same_length(L, M), append(A, [X|B], L), append([X|B], A, M).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment