From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#17623: 24.4.50; incorrect example for `apply-partially' in (elisp) `Calling Functions' Date: Sat, 23 Oct 2021 04:05:51 -0700 Message-ID: References: <9fd43ff1-d6cf-4ac6-b173-2fd634f45a98@default> <871tua2o12.fsf@web.de> <1ac7ebe5-6b43-4367-beb8-df7d9f5b6750@default> <87tx75ni8k.fsf@web.de> <8338ep6kk1.fsf@gnu.org> <87pphsor8h.fsf@web.de> <83tx746fgd.fsf@gnu.org> <87ee8cyt1m.fsf@web.de> 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="26129"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 17623-done@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 23 13:07:19 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1meErt-0006bL-1S for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Oct 2021 13:07:17 +0200 Original-Received: from localhost ([::1]:33982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1meErr-00027K-Ew for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Oct 2021 07:07:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1meEre-000276-TX for bug-gnu-emacs@gnu.org; Sat, 23 Oct 2021 07:07:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51194) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1meEre-0007lg-KV for bug-gnu-emacs@gnu.org; Sat, 23 Oct 2021 07:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1meEre-000209-ES for bug-gnu-emacs@gnu.org; Sat, 23 Oct 2021 07:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Oct 2021 11:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17623 X-GNU-PR-Package: emacs Original-Received: via spool by 17623-done@debbugs.gnu.org id=D17623.16349871637602 (code D ref 17623); Sat, 23 Oct 2021 11:07:02 +0000 Original-Received: (at 17623-done) by debbugs.gnu.org; 23 Oct 2021 11:06:03 +0000 Original-Received: from localhost ([127.0.0.1]:34507 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1meEqh-0001yX-4g for submit@debbugs.gnu.org; Sat, 23 Oct 2021 07:06:03 -0400 Original-Received: from mail-pl1-f177.google.com ([209.85.214.177]:40637) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1meEqb-0001xe-RT for 17623-done@debbugs.gnu.org; Sat, 23 Oct 2021 07:06:01 -0400 Original-Received: by mail-pl1-f177.google.com with SMTP id v20so4524245plo.7 for <17623-done@debbugs.gnu.org>; Sat, 23 Oct 2021 04:05:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=umqXAmRRz6Mvw2rdp2+gwW4mBYuHSaAb/5a3UMtD+B4=; b=EOLspIDjzb04ei8L4aps9Bj/ubuU/J8Lv+IA94Yqcy/MDW29Lf5t38B3XgDeHGq3/C K2plINGOIHiXAJfaJ+G5ce5cOMNa2NPJIIuGgfQBSZ9GBPKug0gzCvs6O5x4rztgmtok Y2J/FhJXONI9h4+j2TjQMHjfIsmt88an09QBfl14spzRUrdSUpPLCvIZ+d0RnRgYA9Ze mdoqHPlLHeaTIfseh0fNEUDszm0WvgJB4nnHTQZqDRD9VPFI7Uu5KWaXcucOI/iAjpZ6 Fm7x4tecM4XsKiYwe5SJSHRzsKrkxa3WzCyFEw/LSIVLCAMNPKY1WFqFaAmf8cPxB1Cl 7FcA== X-Gm-Message-State: AOAM533gKKeICj9iq83WphYLc1F6U7yYJQVztW66ahaQh/qz4nvIzihc PrlvNEe/rbirm4jmUjobsEtoWg+BGnWhFbIIGGM= X-Google-Smtp-Source: ABdhPJzGAMKQmJuuROoEfIhh7R3jrCncsBnYqFMnW7tc1WDwuhvvJPUy3Q4GIwEx/GZ4uVnkrnnfAlfU5APNSG3xa0k= X-Received: by 2002:a17:902:c7c3:b0:140:2033:662c with SMTP id r3-20020a170902c7c300b001402033662cmr4926391pla.32.1634987152172; Sat, 23 Oct 2021 04:05:52 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 23 Oct 2021 04:05:51 -0700 In-Reply-To: <87ee8cyt1m.fsf@web.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:217970 Archived-At: Michael Heerdegen writes: > I disagree. The paragraph in the manual explains what the arity of the > function returned by `apply-partially' would be. > > Directly following is an example suggesting that (apply-partially '+ 1) > is equivalent to #'1+ - which obviously contradicts that preceding > paragraph. > > I'm a bit confused that you don't consider this a problem, and also that > you said there were no concrete suggestions. I have re-read the paragraph, and I have to say that IMO it is clear as is written. But I understand that you feel that it is not. > There were concrete suggestions for improvements. One was to simply > spell out the function that is constructed. It is only one line, and > would make the semantics clear. Instead of going into all that, can't we just find an example where the arity doesn't present any problems? Any ideas for something like that? How about zerop? (defalias 'zerop (apply-partially '= 0) "Return t if argument is zero.") But I guess `=' is also N-ary... > BTW, whenever I posted an example using `apply-partially', Stefan told > me that it would be more efficient to write out the lambda. That aspect > could also be covered: when is worth using? That could be useful to add, I agree. > Or delete that paragraph, better to say nothing than to confuse readers. I think it should be kept. Performance is not the only consideration. (apply-partially #'fun foo bar baz) (lambda (&rest args) (apply #'fun foo bar baz args)) It's obviously a matter of style but I find the former easier to read than the latter.