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


Groups > comp.lang.python > #93959

Re: A new module for performing tail-call elimination

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'elif': 0.04; '(even': 0.05; 'none:': 0.05; 'true)': 0.07; 'ugly': 0.07; '(none,': 0.09; 'false)': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'subject:module': 0.09; 'syntax': 0.13; 'def': 0.13; 'async': 0.16; 'constructs': 0.16; 'fn)': 0.16; 'looping': 0.16; 'loops': 0.16; 'reedy': 0.16; 'sense,': 0.16; 'syntactical': 0.16; 'wrote:': 0.16; 'example.': 0.18; 'language': 0.19; '>>>': 0.20; 'all,': 0.20; '%s"': 0.22; 'mind.': 0.22; 'am,': 0.23; 'needed.': 0.23; 'header:In-Reply- To:1': 0.24; 'header:User-Agent:1': 0.26; 'example': 0.26; 'opposed': 0.27; '~ethan~': 0.29; 'raise': 0.29; 'certain': 0.31; 'another': 0.32; 'core': 0.32; 'add': 0.34; 'could': 0.35; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'really': 0.37; 'enough': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'easy': 0.60; 'charset:windows-1252': 0.62; 'here': 0.66; 'await': 0.76; '2:02': 0.84; 'odd,': 0.84; 'pardon': 0.84; 'received:10.1.10': 0.84; 'wow': 0.84; 'ethan': 0.91; 'furman': 0.91
Date Thu, 16 Jul 2015 12:58:44 -0700
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version 1.0
To python-list@python.org
Subject Re: A new module for performing tail-call elimination
References <55a3dcd9$0$3024$426a34cc@news.free.fr> <mailman.532.1436952589.3674.python-list@python.org> <55a76628$0$2846$c3e8da3$76491128@news.astraweb.com> <55A78A42.4090506@rece.vub.ac.be> <CAPTjJmr4TJuMpgPm_cuMo_eM-xuNfgyLbTFvqA36mFvpNxQ1UA@mail.gmail.com> <55A7B309.8080903@rece.vub.ac.be> <55A7F1A7.9000203@stoneleaf.us> <mo91lp$g2e$1@ger.gmane.org>
In-Reply-To <mo91lp$g2e$1@ger.gmane.org>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.609.1437076730.3674.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1437076730 news.xs4all.nl 2859 [2001:888:2000:d::a6]:38789
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93959

Show key headers only | View raw


On 07/16/2015 12:45 PM, Terry Reedy wrote:
> On 7/16/2015 2:02 PM, Ethan Furman wrote:
>> On 07/16/2015 06:35 AM, Antoon Pardon wrote:
>
>>> Here is one way to do the odd, even example.
>>>
>>> def even(n):
>>>      return odd_even('even', n)
>>>
>>> def odd(n):
>>>      return odd_even('odd', n)
>>>
>>> def odd_even(fn, n):
>>>      while fn is not None:
>>>          if fn == 'even':
>>>              fn, n = (None, True) if n == 0 else ('odd', n - 1)
>>>          elif fn == 'odd':
>>>              fn, n = (None, False) if n == 0 else ('even', n - 1)
>>>          else:
>>>              raise ValueError("Unknown state: %s" % fn)
>>>      return n
>>
>> Wow -- definitely uglier and less easy to understand than the original
>> (even if the original had had the error-checking).
>
> What you call ugly is an example of the core of the proof that alternation and indefinite
>  while looping are enough for turing completeness, and that no recursive syntax is needed.
> Another way to put it is that while loops perform recursion in the operational sense, as
>  opposed to the syntactical sense.

And we add new constructs and new language features to make certain ways of thinking/programming easier -- async and await come to mind. ;)  After all, we don't really even need while loops as we 
could get by with if and goto.

--
~Ethan~

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


Thread

A new module for performing tail-call elimination "Th. Baruchel" <baruchel@no.spam.gmx.dot.com> - 2015-07-13 15:44 +0000
  Re: A new module for performing tail-call elimination Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-07-15 11:29 +0200
    Re: A new module for performing tail-call elimination Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-07-16 18:07 +1000
      Re: A new module for performing tail-call elimination Robin Becker <robin@reportlab.com> - 2015-07-16 10:13 +0100
      Re: A new module for performing tail-call elimination Robin Becker <robin@reportlab.com> - 2015-07-16 10:28 +0100
        Re: A new module for performing tail-call elimination Marko Rauhamaa <marko@pacujo.net> - 2015-07-16 12:56 +0300
      Re: A new module for performing tail-call elimination Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-07-16 12:41 +0200
        Re: A new module for performing tail-call elimination Steven D'Aprano <steve@pearwood.info> - 2015-07-17 04:58 +1000
          Re: A new module for performing tail-call elimination Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-07-17 11:00 +0200
      Re: A new module for performing tail-call elimination Chris Angelico <rosuav@gmail.com> - 2015-07-16 21:11 +1000
      Re: A new module for performing tail-call elimination Jeremy Sanders <jeremy@jeremysanders.net> - 2015-07-16 13:29 +0200
      Re: A new module for performing tail-call elimination Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-07-16 15:35 +0200
      Re: A new module for performing tail-call elimination Chris Angelico <rosuav@gmail.com> - 2015-07-16 23:47 +1000
        Re: A new module for performing tail-call elimination Paul Rubin <no.email@nospam.invalid> - 2015-07-17 20:06 -0700
      Re: A new module for performing tail-call elimination Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-07-16 16:21 +0200
      Re: A new module for performing tail-call elimination Chris Angelico <rosuav@gmail.com> - 2015-07-17 00:27 +1000
      Re: A new module for performing tail-call elimination Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-07-16 17:14 +0200
      Re: A new module for performing tail-call elimination Ian Kelly <ian.g.kelly@gmail.com> - 2015-07-16 10:17 -0600
      Re: A new module for performing tail-call elimination Ethan Furman <ethan@stoneleaf.us> - 2015-07-16 10:54 -0700
      Re: A new module for performing tail-call elimination Ethan Furman <ethan@stoneleaf.us> - 2015-07-16 11:02 -0700
      Re: A new module for performing tail-call elimination Terry Reedy <tjreedy@udel.edu> - 2015-07-16 15:45 -0400
      Re: A new module for performing tail-call elimination Ethan Furman <ethan@stoneleaf.us> - 2015-07-16 12:58 -0700
      Re: A new module for performing tail-call elimination Robin Becker <robin@reportlab.com> - 2015-07-17 09:57 +0100
    Re: A new module for performing tail-call elimination Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2015-07-16 13:23 +0200
  Re: A new module for performing tail-call elimination Terry Reedy <tjreedy@udel.edu> - 2015-07-15 17:19 -0400
  Re: A new module for performing tail-call elimination Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-07-16 09:45 +0200
  Re: A new module for performing tail-call elimination Terry Reedy <tjreedy@udel.edu> - 2015-07-16 15:34 -0400
    Re: A new module for performing tail-call elimination Marko Rauhamaa <marko@pacujo.net> - 2015-07-16 22:45 +0300
      Re: A new module for performing tail-call elimination Terry Reedy <tjreedy@udel.edu> - 2015-07-17 15:47 -0400
        Re: A new module for performing tail-call elimination Marko Rauhamaa <marko@pacujo.net> - 2015-07-17 23:55 +0300
          Re: A new module for performing tail-call elimination Terry Reedy <tjreedy@udel.edu> - 2015-07-17 20:40 -0400
            Re: A new module for performing tail-call elimination Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-07-19 10:39 +1200
          Re: A new module for performing tail-call elimination Chris Angelico <rosuav@gmail.com> - 2015-07-18 10:47 +1000
          Re: A new module for performing tail-call elimination Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-07-19 10:39 +1200
      Re: A new module for performing tail-call elimination Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-07-19 10:39 +1200
        Re: A new module for performing tail-call elimination Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-19 01:09 +0100
        Re: A new module for performing tail-call elimination MRAB <python@mrabarnett.plus.com> - 2015-07-19 01:19 +0100
        Re: A new module for performing tail-call elimination Marko Rauhamaa <marko@pacujo.net> - 2015-07-19 09:29 +0300
  Re: A new module for performing tail-call elimination Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-07-17 10:06 +0200

csiph-web