From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] seq.el: add seq-last for symmetry with seq-first Date: Tue, 14 Mar 2023 19:35:36 +0100 Message-ID: <87r0trb2pz.fsf@gmail.com> References: <871qlrmr14.fsf@gmail.com> <87fsa7cq0v.fsf@posteo.net> <87wn3jl4f8.fsf@gmail.com> <875yb3cntx.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23893"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: =?utf-8?B?TWF0w7rFoQ==?= Goljer , emacs-devel@gnu.org To: Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 14 19:36:30 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pc9Vd-00065C-Pj for ged-emacs-devel@m.gmane-mx.org; Tue, 14 Mar 2023 19:36:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pc9Ux-0002Gn-U7; Tue, 14 Mar 2023 14:35:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pc9Ut-0002GB-5u for emacs-devel@gnu.org; Tue, 14 Mar 2023 14:35:43 -0400 Original-Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pc9Ur-00041F-MA for emacs-devel@gnu.org; Tue, 14 Mar 2023 14:35:42 -0400 Original-Received: by mail-ed1-x533.google.com with SMTP id cn21so35732672edb.0 for ; Tue, 14 Mar 2023 11:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678818938; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=9W46onXjvUhqV3MJR2dhcKsSUJn7gh8MRGjzb66XOvY=; b=T7bIGz4WCeDDlmSelBYmBDM20ceOao4+w4hOVFFQat3SyL7h/5UpmVdi/xn4IyAOd/ SQB2m28vb1vXqHw/YRtfkjaBDWTI0mWcSBOcOjFdwMQfk6jsoTrlHeN4XMAwksaLxcdB 1ybWW6tLRp77Eb3Vaq3zNA7LFMV0zey4V6iE/T48eZaX+qtL8b9bQfMT1kLhLCmsJ9c+ vi5rdcDyJo9ONJk/PV19dOeU/X9WIzO63uDdYgANwRL+B6MEugMKyMttdeFXoASKdAth /w0eDLGB8RIxuwvnxJg7Py8JjbSy/L4yESmBhwSrxc09bvsv/LiGsfknysOw1QonUPsR 84eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678818938; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9W46onXjvUhqV3MJR2dhcKsSUJn7gh8MRGjzb66XOvY=; b=sWyXf1tSev0qCZ/uJWTyDit/dhgd0Lq7qR+ZmjUwWKATF6KtjAg2DviuVN0pcCPiIX sD6NfXjD7t4BhwZlYcFEZltBo5BJspeASQBJNDgLlkXTaMvgwyeWmA2JZ2Q7gwFl6wxP n8vuNswLROuZFs8rECEscgKlVojqVkgRbJPDuQzmgPG9bsbK/OGvo1VvRenqYk/BwlW+ SMSMk0rWFhTsnD5++A/7haZsU/4ZQjYmstx8BoeirkwSlrHt0Wj1vI85bO0cZDMzaOtF qDFDcAMQR4bJ9WdJe3EwnVI8XCJu9Ny5L6dMYugcHnPpz306NMHhOD5tPuI5tNELVQro h5GA== X-Gm-Message-State: AO0yUKViA9NEZCa6XpvF8zzf1z/Hpqxm7BTMJT2Txz14yeJY5yCt6vDi YJXf74RgBMI93P59pML1ONPbZCcJcSU= X-Google-Smtp-Source: AK7set9EAzBE+jYx2j/3B2387Tdft3AT3i7R18o3lv3mXmNe38EavncjRKa8mVg6PGstRNXX2SR2Wg== X-Received: by 2002:a17:906:bc90:b0:878:78f9:d1be with SMTP id lv16-20020a170906bc9000b0087878f9d1bemr2939412ejb.23.1678818938237; Tue, 14 Mar 2023 11:35:38 -0700 (PDT) Original-Received: from ars3 (ip5f5aef2f.dynamic.kabel-deutschland.de. [95.90.239.47]) by smtp.gmail.com with ESMTPSA id h25-20020a17090619d900b008b9b4ab6ad1sm1467309ejd.102.2023.03.14.11.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 11:35:37 -0700 (PDT) In-Reply-To: <875yb3cntx.fsf@posteo.net> (Philip Kaludercic's message of "Tue, 14 Mar 2023 16:14:18 +0000") Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=arstoffel@gmail.com; helo=mail-ed1-x533.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304455 Archived-At: Maybe it's more useful to allow negative arguments in seq-elt? Saying (seq-elt seq -1) isn't much more effort than (seq-last seq). On Tue, 14 Mar 2023 at 16:14, Philip Kaludercic wrote: >> I think for lists it should behave as `nth` or `elt`, so it gives nil. > > But why? Wouldn't that be a leaky abstraction, since the behaviour > doesn't consistently abstract over the concrete sequence types? If code > doesn't want to worry about what sequence is being used, then it has to > manually check the return value or if a signal was raised, depending on > the type of the argument to seq-last (which is to ignore the issue that > we cannot distinguish between (seq-first '()) and (seq-first '(nil)), > the same also being the case for seq-last). It would be good to look systematically at what errors seq.el can signal. But it also seems that in practice the main value of seq.el is to provide a bunch of handy functions rather than allowing you to work with a sequence whose type you don't know.