Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9836

Re: Partial Function Application -- Advantages over normal function?

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <SRS0=I1mB=2F=ieee.org=davea@srs.perfora.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'arguments': 0.05; 'terry': 0.07; '"hello': 0.09; 'subject:Function': 0.09; 'am,': 0.13; 'wrote:': 0.15; 'parameters,': 0.16; 'reedy': 0.16; 'subject:function': 0.16; 'cc:addr:python-list': 0.16; 'pm,': 0.16; 'this:': 0.16; 'def': 0.16; 'seems': 0.20; 'cc:2**0': 0.21; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'subject: -- ': 0.25; '(or': 0.25; 'function': 0.26; 'paul': 0.28; 'partial': 0.29; 'cc:addr:python.org': 0.30; 'example': 0.30; 'subject:?': 0.31; 'header:User-Agent:1': 0.34; 'couple': 0.34; 'function.': 0.35; 'some': 0.37; 'received:192': 0.38; 'subject:: ': 0.38; 'two': 0.38; 'received:192.168.1': 0.39; 'order': 0.62; 'act': 0.64; 'taking': 0.65; 'header:Reply-To:1': 0.71; 'reply- to:no real name:2**0': 0.72; '02:59': 0.84; 'subject:over': 0.84; 'typos': 0.84
Date Mon, 18 Jul 2011 17:45:56 -0400
From Dave Angel <davea@ieee.org>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10
MIME-Version 1.0
To Terry Reedy <tjreedy@udel.edu>
Subject Re: Partial Function Application -- Advantages over normal function?
References <201107181543.42229.kurianmthayil@gmail.com> <CACNEfZaLVqY=HFvRGYbKMFxLtYBU0gLDmFfMguorJznDGOh=yA@mail.gmail.com> <j0239q$smp$1@dough.gmane.org>
In-Reply-To <j0239q$smp$1@dough.gmane.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:gew4u8U3PVLxJJzxsDeNXJVV5nQf3GlwSijM8uXO3Zk B07RkGls0DGnXaJQEkDFeLpED6ZhOx4CwNFqH2umTF6+P13B6i kFyK1xUlTkftbeBwWhFT9kQCkjuaFXJ/xdu1U7QYZbqmEMhOoP +BIWe+rGjoe/eepRNwG4V5vxyUrvGrP2IPGlc3t0H+w35mdVDV Wiikxsj3gLgv3l0mHVywA==
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To davea@ieee.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1232.1311025576.1164.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1311025576 news.xs4all.nl 23854 [2001:888:2000:d::a6]:51001
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:9836

Show key headers only | View raw


On 01/-10/-28163 02:59 PM, Terry Reedy wrote:
> On 7/18/2011 8:24 AM, Paul Woolcock wrote:
>> Partial function application (or "currying") is the act of taking a
>> function with two or more parameters, and applying some of the arguments
>> in order to make a new function.  The "hello world" example for this
>> seems to be this:
>> <snip>
>
> def makeadder(y)
>     def _add(x): return x+y
> add2 = makeadder(2)
>
> <snip>

A couple of typos in that code:


def makeaddr(y):
     def _add(x): return x+y
     return _add


DaveA

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Partial Function Application -- Advantages over normal function? Dave Angel <davea@ieee.org> - 2011-07-18 17:45 -0400
  Re: Partial Function Application -- Advantages over normal function? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-19 00:28 +0200
    Re: Partial Function Application -- Advantages over normal function? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-19 00:33 +0200
      Re: Partial Function Application -- Advantages over normal function? Thomas Jollans <t@jollybox.de> - 2011-07-19 08:22 +0200
      Re: Partial Function Application -- Advantages over normal function? Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-19 10:49 -0600
      Re: Partial Function Application -- Advantages over normal function? Thomas Jollans <t@jollybox.de> - 2011-07-19 18:58 +0200
      Re: Partial Function Application -- Advantages over normal function? Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-19 11:15 -0600
    Re: Re: Partial Function Application -- Advantages over normal function? Dave Angel <davea@ieee.org> - 2011-07-19 06:07 -0400
    Re: Partial Function Application -- Advantages over normal function? Terry Reedy <tjreedy@udel.edu> - 2011-07-19 12:47 -0400

csiph-web