• Re: diff1(x) in Python: True if all adjacent items (Posting On Python-L

    From Lawrence D'Oliveiro@21:1/5 to HenHanna on Sun Jun 16 01:10:20 2024
    XPost: comp.lang.lisp

    On Sat, 15 Jun 2024 17:52:18 -0700, HenHanna wrote:

    Lispers can learn from Pythonicity and vice versa.

    diff2 = \
    lambda x : \
    (
    lambda : True,
    lambda : all(abs(a - b) == 1) for a, b in zip(x, x[1:]),
    )[len(x) > 1]()

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)