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


Groups > comp.lang.python > #9858

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

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!feeder.news-service.com!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <t@jollybox.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.033
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'terry': 0.07; '>>>>': 0.09; 'subject:Function': 0.09; 'wrote:': 0.15; 'lambda': 0.16; 'received:192.168.1.40': 0.16; 'reedy': 0.16; 'simplified': 0.16; 'subject:function': 0.16; 'pm,': 0.16; '>>>': 0.16; 'def': 0.16; 'header:In-Reply-To:1': 0.22; 'subject: -- ': 0.25; 'subject:?': 0.31; "skip:' 10": 0.32; 'to:addr:python-list': 0.34; 'header :User-Agent:1': 0.34; 'couple': 0.34; 'agree': 0.35; 'statement,': 0.35; 'addresses': 0.36; 'but': 0.37; 'received:192': 0.38; 'subject:: ': 0.38; 'received:192.168.1': 0.39; 'to:addr:python.org': 0.39; 'received:62': 0.67; 'factory': 0.73; '02:59': 0.84; 'from:addr:t': 0.84; 'subject:over': 0.84; 'typos': 0.84
Date Tue, 19 Jul 2011 08:22:04 +0200
From Thomas Jollans <t@jollybox.de>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110626 Iceowl/1.0b2 Icedove/3.1.11
MIME-Version 1.0
To python-list@python.org
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> <mailman.1232.1311025576.1164.python-list@python.org> <1405042.q1RDiLHYyK@PointedEars.de> <4247181.bSrEuok8ZT@PointedEars.de>
In-Reply-To <4247181.bSrEuok8ZT@PointedEars.de>
X-Enigmail-Version 1.1.2
OpenPGP id=5C8691ED
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
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.1239.1311056526.1164.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1311056526 news.xs4all.nl 23957 [2001:888:2000:d::a6]:39586
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:9858

Show key headers only | View raw


On 19/07/11 00:33, Thomas 'PointedEars' Lahn wrote:
> Thomas 'PointedEars' Lahn wrote:
> 
>> Dave Angel wrote:
>>> On 01/-10/-28163 02:59 PM, Terry Reedy wrote:
>>>> def makeadder(y)
>>>>     def _add(x): return x+y
>>>> add2 = makeadder(2)
>>>
>>> A couple of typos in that code:
>>>
>>> def makeaddr(y):
>>>      def _add(x): return x+y
>>>      return _add
>>
>> I agree about the `return' statement, but not about the factory name; this
>> has nothing to do with addresses (addr).
> 
> Supplemental: The above can be simplified to
> 
> def makeadder(y): return lambda x: x + y
> 

In turn:

makeadder = lambda y: lambda x: x + y

Smells of Haskell.

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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