unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: Adam Porter <adam@alphapapa.net>,  emacs-devel@gnu.org
Subject: Re: Compiler macro for apply-partially
Date: Wed, 25 Aug 2021 14:27:32 -0400	[thread overview]
Message-ID: <jwvlf4p757r.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87k0k9beqc.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Wed, 25 Aug 2021 10:45:15 -0700")

> For us slower kids, this explicit approach might look like:
>
> (cl-flet ((curried (arg3)
> 		   (function-to-apply-partially arg1 arg2 arg3)))
>   (curried "arg3"))
>
> Either that or just plain `let' a lambda, and then `funcall' it?

I just meant that instead of writing

    (apply-partially #'foo arg1 arg2)

you write

    (lambda (arg3 &optional arg4 ...)
      (foo arg1 arg2 arg3 arg4 ...))

A compiler macro can't easily do it for you because it's between hard
and impossible to automatically guess the (arg3 &optional arg4 ...)
part.


        Stefan




  reply	other threads:[~2021-08-25 18:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24  6:37 Compiler macro for apply-partially Adam Porter
2021-08-24  6:51 ` Adam Porter
2021-08-24  7:22   ` Andreas Schwab
2021-08-24  7:38     ` Adam Porter
2021-08-24 22:32 ` Stefan Monnier
2021-08-25 17:45   ` Eric Abrahamsen
2021-08-25 18:27     ` Stefan Monnier [this message]
2021-08-25 18:44       ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvlf4p757r.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=adam@alphapapa.net \
    --cc=emacs-devel@gnu.org \
    --cc=eric@ericabrahamsen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).