simon-git: spigot (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Tue Oct 17 19:55:05 BST 2017


TL;DR:
  4e668b8 Change BASE_NEG and BASE_CHANGE into wrappers.

Repository:     https://git.tartarus.org/simon/spigot.git
On the web:     https://git.tartarus.org/?p=simon/spigot.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2017-10-17 19:55:05

commit 4e668b8c6e085b91db0869446134697e2e4a73dc
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=4e668b8c6e085b91db0869446134697e2e4a73dc;hp=b1dafb1213db62514e1c97333fd8b2983977956d
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Oct 17 19:40:48 2017 +0100

    Change BASE_NEG and BASE_CHANGE into wrappers.
    
    (Also, I've renamed BASE_CHANGE in the process, to better match its
    new usage mode.)
    
    Now instead of being _interleaved_ in the digit stream with ordinary
    integers, they each _contain_ the integer that they would previously
    have followed. So the initial term (integer part) in a digit stream is
    either an integer, or BASE_NEG(an integer); and any subsequent term is
    either an integer (which will be interpreted in the specified default
    base), or BASE_DIGIT(base, integer) which will be interpreted in a
    different base.
    
    This is more sensible because it means I can statelessly convert any
    element of a stream into the underlying interval representation -
    which means I can also support the same space-efficient system as I do
    for continued-fraction input, in which the user provides a function
    returning the nth element of the stream rather than an iterator whose
    output has to be cached. Tests of the latter added.

 python/demo.py          | 10 ++++------
 python/spig/__init__.py | 51 ++++++++++++++++++++++++++-----------------------
 python/testsuite.py     | 31 ++++++++++++++++++++++++------
 3 files changed, 56 insertions(+), 36 deletions(-)



More information about the tartarus-commits mailing list