Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <20240615173407.24@kylheku.com>
Deutsch   English   Français   Italiano  
<20240615173407.24@kylheku.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feed.opticnetworks.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.python,comp.lang.lisp
Subject: Re: diff1(x) in Python: True if all adjacent items differ by 1,
 False otherwise.
Date: Sun, 16 Jun 2024 00:34:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <20240615173407.24@kylheku.com>
References: <v4kuk5$3k353$1@dont-email.me> <8734pd7v1r.fsf@nightsong.com>
 <v4lanu$3mt2j$1@dont-email.me>
Injection-Date: Sun, 16 Jun 2024 02:34:33 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="f04802f881217b7539658feaa16a1466";
	logging-data="3902551"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19kRnrHGm1OlaU+f7SEV5jHdQ891zQVfDM="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:0zggLhn1+Wgme/FhMJUldr+6//0=
Bytes: 1493

On 2024-06-16, HenHanna <HenHanna@devnull.tb> wrote:
> On 6/15/2024 2:30 PM, Paul Rubin wrote:
>> HenHanna <HenHanna@devnull.tb> writes:
>>> def diff1(x):
>>>      if len(x) <= 1: return True
>>>      for i in range(len(x) - 1):
>>>          if abs(x[i] - x[i+1]) != 1:    return False
>>>      return True
>> 
>> def diff2(x):
>>    return all(abs(a-b)==1) for a,b in zip(x,x[1:]))
>
>
> Does this work when x is  []  or  [1]  ?

Can we keep this abject filth out of the Lisp newsgroup?

Thanks. :)