From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: Always-true predicate? Date: Fri, 19 Feb 2021 11:27:52 +0000 Message-ID: References: <875z2qoqc6.fsf@gnus.org> <87h7ma25so.fsf@tcd.ie> <8735xu33jy.fsf@gnus.org> <87lfbm1o5s.fsf@gnus.org> <874kiaxxbs.fsf@iki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9742"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "Basil L. Contovounesios" , Lars Ingebrigtsen , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 19 12:29:09 2021 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 1lD3y7-0002Nt-MD for ged-emacs-devel@m.gmane-mx.org; Fri, 19 Feb 2021 12:29:07 +0100 Original-Received: from localhost ([::1]:52244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD3y6-0004if-NR for ged-emacs-devel@m.gmane-mx.org; Fri, 19 Feb 2021 06:29:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD3xX-0004Hu-RA for emacs-devel@gnu.org; Fri, 19 Feb 2021 06:28:31 -0500 Original-Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]:46531) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lD3xW-0003Ln-4O for emacs-devel@gnu.org; Fri, 19 Feb 2021 06:28:31 -0500 Original-Received: by mail-ot1-x335.google.com with SMTP id o10so4752147ote.13 for ; Fri, 19 Feb 2021 03:28:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=idDz8CPk50kis6+sL3toyRrWytT8RlY94K16RoMqKcc=; b=VoiGJ2q4S6PgsQSY/p2hhw6Hj+28Kus/ZQ2UCqg38il3378X4NOVtgLwnh0xZwYAeQ qKAyYWVr9IrBOZzR70gN3I4pa6EGWO0D/qJdFxAg/4KgN5hVyQxhrWi64RAN8nPuFx41 XlPIT2ri9oxWLrOeSaMpaJKCpxL26haq0KKOodEcMB6cFbxb22P1y3rmFXW0SoTSp2vb xqN8kPXpMfdlL7X+xXxe/+qzux4lxDTbBFi/OxNxAVp6D9xyacZviVO6zoLKf662NYjj cn8Fk49nzCUqy1dq1Od0zXVtb92KTEiGkCeFEu8rWkR22223srfs+ZQ6w5EQma5YO4yP i/3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=idDz8CPk50kis6+sL3toyRrWytT8RlY94K16RoMqKcc=; b=FafHMa+gDZbIZydtfImY/+HQ1m3gpfLeZ8y8x3BiJzHAUIz6gr/5uYoS3DnHjBSaYZ owsewH0Vk3dAQ5Epxka+2+e5JZD4OZfjx5Vh3+qfdILimsLrQ1S0Is1GpTpU4AQoS6ZS cNjsllNtVOnQyMJgLzzHJw7MPXdW3+sMcJu9La35QfgHDbF9VnLsXMoFJU3mlj57bKiP InoaIUW25HahRwtCykYZONi4l+vo6smKVXjfiPWPmq/Cr2RORKH87N19i+UKaZsYkOpc s8W2KWacUhl6aBIsnPKytAdx0TZiIU9obbn/MJvpegXoVYMZxRlUsMt1aJyH3PxOQdq7 nAkw== X-Gm-Message-State: AOAM530AOGLTD+B+VjkeBg0b/0VBppJNBo945KIUAEUSn6MUWBNifZTr TBxYqtnDmmFSzdlvoi3LPu4p87kh7s7n8d/cma4= X-Google-Smtp-Source: ABdhPJwGH2qULgzNh+VLHzmxR/2t0IiBO4rCrDD4boV+h7Iu92G1JSzrYqmzAWSPrn3ba3dLyse+OUpb+awW7BrImnQ= X-Received: by 2002:a05:6830:1682:: with SMTP id k2mr6396960otr.154.1613734108385; Fri, 19 Feb 2021 03:28:28 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=pipcet@gmail.com; helo=mail-ot1-x335.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.23 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" Xref: news.gmane.io gmane.emacs.devel:265222 Archived-At: On Wed, Feb 17, 2021 at 11:01 PM Stefan Monnier wrote: > > Seriously: I remember one case when I tried to find CONSTANTLY or > > similar but failed. I wrote some LAMBDA form. No big deal. > > Maybe we should let `lambda` take arguments like Scheme does, i.e. > (lambda (a b . c) FOO) instead of (lambda (a b &rest c) FOO), and in that > case we could simple use "lambda _" as a shorthand for "constantly". That would break things like pcase-lambda, though: we would no longer be able to generalize lambda meaningfully. TL;DR - let's make (lambda (&rest) t) valid for the universal predicate and leave it at that. Anyway, my problem with variadic functions isn't defining them, it's calling them. I think I should be able to say (f a b c &rest d) rather than (apply #'f a b c d) which would make usage mimic declaration. Kind of like JavaScript's ... operator (and in fact that would be a better name for it than &rest, IMHO, though of course it should be a symbol rather than extra syntax). (For extra fun, consider (f &rest a &rest b) = (apply #'f (append a b)) and (f &rest keywords values) = (apply #'f (zip keywords values)) (I don't like apply, even when it's not (apply nil), mostly because (apply #'f 'a 'b nil) isn't necessarily equivalent to (f 'a 'b) [1]) As for the universal predicate, I'd like to be able to write (lambda (&rest) t), which would save two characters. (lambda (...) t) would save another one :-) ) And if we can require optional arguments, why can't we provide them optionally? For example, let's say in Emacs 33 we want to expand copy-marker with a new argument to more clearly describe how the marker repositions itself relative to other markers (or implicit) markers at the same character position. But (copy-marker marker nil &optional 'something) would work in Emacs 32 (which would include the optionally-provided argument extension), and be equivalent to (copy-marker marker nil) there. Pip [1] - if f is a macro, for example. The byte compiler has a fun bug if you feed it this input: (defun eval-then-throw (a b) (apply #'or a (eval b) nil)) (eval-then-throw t '(message "printme")) (byte-compile 'eval-then-throw) (eval-then-throw t '(message "printme"))