1: # True if the list xs is a suffix of the list ys, or vice versa 2: { lib, reverse }: 3: 4: with builtins; 5: with lib; 6: xs: ys: 7: with rec { 8: lx = length xs; 9: ly = length ys; 10: minlen = if lx < ly then lx else ly; 11: }; 12: take minlen (reverse xs) == take minlen (reverse ys)