From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel Subject: Re: What's up with apply-partially? Date: Sat, 24 Jan 2015 01:53:36 -0200 Message-ID: References: <874mrh5emp.fsf@fencepost.gnu.org> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1422071624 18259 80.91.229.3 (24 Jan 2015 03:53:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 24 Jan 2015 03:53:44 +0000 (UTC) Cc: emacs-devel To: David Kastrup Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 24 04:53:44 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YErn5-0002Kj-PS for ged-emacs-devel@m.gmane.org; Sat, 24 Jan 2015 04:53:43 +0100 Original-Received: from localhost ([::1]:33932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YErn5-0005Zo-1L for ged-emacs-devel@m.gmane.org; Fri, 23 Jan 2015 22:53:43 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YErn1-0005ZY-VL for emacs-devel@gnu.org; Fri, 23 Jan 2015 22:53:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YErn0-0008HD-Vf for emacs-devel@gnu.org; Fri, 23 Jan 2015 22:53:39 -0500 Original-Received: from mail-ob0-x232.google.com ([2607:f8b0:4003:c01::232]:35743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YErmz-0008GV-MF; Fri, 23 Jan 2015 22:53:37 -0500 Original-Received: by mail-ob0-f178.google.com with SMTP id nt9so790472obb.9; Fri, 23 Jan 2015 19:53:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=XmJIk6zVUtnrKLS+uNJY77QT9AGqnjOwacQD6k17WXI=; b=uwiBXnAN3Q8hYLoUOxMUxQRQ7Zg5ZhO77OAnWe6lG3AkI9V9sNHF2Vad2ynr+NfrEV niDuMCU6KnSq+93vHOOF9U0Jue+cZMxKsggP4S9V8Amf8xQYQTJ3qWaBp4t6eY0YNYw3 GkKSiBHpH1bOudkjsinRVEsMKjUdye58g4CGYi0PfQwjKFJPAyNhUbY+3V9xkzSfpe6d NoMkQPVAzTqu8SypqmQGywpLYqz1okCbBJPYnDSyIF15+mk4cTnicKU0faKdCjmt0P+X 8T4r6gJuiyCL6A/DLGYe9JpgWY5L+e3zcxQmh3DD3r0ARFlVoph1tCHfjpXCEkO2tkpR CKLg== X-Received: by 10.60.135.3 with SMTP id po3mr6568350oeb.58.1422071616967; Fri, 23 Jan 2015 19:53:36 -0800 (PST) Original-Received: by 10.76.125.1 with HTTP; Fri, 23 Jan 2015 19:53:36 -0800 (PST) In-Reply-To: <874mrh5emp.fsf@fencepost.gnu.org> X-Google-Sender-Auth: RfYp7SbgSyduXPZoCoSrzrk-ETY X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::232 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:181712 Archived-At: > So why not just > > (defun apply-partially (fun &rest args) > (lambda (&rest args2) (apply fun (append args args2)))) > > Where is the point in the complicated redefinition that returns a > basically uncompiled function? Why not just take Eli's definition and > simplify it in line with lexical-binding now being set? As Leo mentioned, the current definition creates the argument list when `apply-partially' is first called, whereas your suggestion has to call `append' everytime the returned function is called. I think that's the only reason. It's unclear to me how that performance difference compares with the disadvantage of the returned function not being compiled.