simon-git: spigot (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Thu Aug 1 20:42:44 BST 2019


TL;DR:
  1e30efd [NFC] Store function args in a subclass of std::vector.
  c9272d5 Introduce ';' as an alternative argument separator.
  f95870c Use semicolons in the debug Hg API.
  2e8c1de Permit a semicolon in algebraic().
  b60d015 Promote Hg from a debug function to a public one.
  4703e3e Permit algebraic() to take rational coefficients.

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:           2019-08-01 20:42:44

commit 1e30efdeeec77101009d3d36b1f71a50a59450de
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=1e30efdeeec77101009d3d36b1f71a50a59450de;hp=664f9f99bef09cc2639ef0d5ed30869d1d4b8bad
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Aug 1 18:53:45 2019 +0100

    [NFC] Store function args in a subclass of std::vector.
    
    The aim of this is to permit function calls in the spigot language to
    contain syntactic elements other than the numeric arguments, and have
    the details of that extra syntax communicated to the function
    implementation.
    
    To arrange this, I introduce a type 'argvector', which subclasses
    std::vector and has an extra member variable 'syntax' to store that
    extra data. Everything through from the expression parser to the
    built-in function implementations uses an argvector, and the syntax
    variable is propagated appropriately. However, at the moment, nothing
    is actually stored in 'syntax'.

 algebraic.cpp |   2 +-
 exp.cpp       |   2 +-
 expr.cpp      | 119 +++++++++++++++++++++++++++++++---------------------------
 funcs.h       |  35 ++++++++++++++---
 hypergeom.cpp |   2 +-
 sqrt.cpp      |   2 +-
 6 files changed, 97 insertions(+), 65 deletions(-)

commit c9272d50c53e57babf8f7cb3541beba169689406
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=c9272d50c53e57babf8f7cb3541beba169689406;hp=1e30efdeeec77101009d3d36b1f71a50a59450de
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Aug 1 18:58:21 2019 +0100

    Introduce ';' as an alternative argument separator.
    
    In function calls, the spigot parser is now capable of recognising
    both comma and semicolon as separating function arguments, and it will
    record in the new argvector::syntax field a list of the argument
    indices which had a semicolon just before them.
    
    The idea is to allow defining variadic functions which include two
    variable-length lists among their arguments: now you can use a
    semicolon to separate the two lists, and then the function syntax can
    be unambiguous without needing extra arguments counting the lengths of
    the two lists.
    
    NFC if you don't count changes to error messages: no function yet uses
    the new facility.

 algebraic.cpp |  1 +
 exp.cpp       |  2 ++
 expr.cpp      | 19 ++++++++++++++++++-
 funcs.h       |  7 +++++++
 hypergeom.cpp |  1 +
 sqrt.cpp      |  1 +
 6 files changed, 30 insertions(+), 1 deletion(-)

commit f95870c7ee2fd143113d57ef2253a49a1885f7ad
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=f95870c7ee2fd143113d57ef2253a49a1885f7ad;hp=c9272d50c53e57babf8f7cb3541beba169689406
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Aug 1 19:01:27 2019 +0100

    Use semicolons in the debug Hg API.
    
    The generalised hypergeometric function takes a variable-length list
    of numerator terms, a variable-length list of denominator terms, and
    the actual function input value. The Hg function enabled by
    --debug-fns now uses semicolons to separate those three classes of
    argument, where it previously took two awkward initial count
    arguments. So where you'd previously have written something like
    Hg(3,2, n1,n2,n3, d1,d2, x), you now write Hg(n1,n2,n3; d1,d2; x),
    which is much closer to the standard mathematical syntax.

 hypergeom.cpp | 42 ++++++++++++++++++------------------------
 1 file changed, 18 insertions(+), 24 deletions(-)

commit 2e8c1deb8dfb0dd49b8e852f77ece2e2dcd74a23
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=2e8c1deb8dfb0dd49b8e852f77ece2e2dcd74a23;hp=f95870c7ee2fd143113d57ef2253a49a1885f7ad
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Aug 1 19:05:04 2019 +0100

    Permit a semicolon in algebraic().
    
    algebraic() doesn't really _need_ disambiguation, because of its two
    distinct sublists of arguments, the first one always has the same
    number of elements (namely two interval bounds). But a semicolon
    separating the two might clarify things for a reader, so let's at
    least _permit_ it even if we don't enforce it.

 algebraic.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

commit b60d0157c6a6045caf9a9992d7f121f67cd0da63
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=b60d0157c6a6045caf9a9992d7f121f67cd0da63;hp=2e8c1deb8dfb0dd49b8e852f77ece2e2dcd74a23
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Aug 1 19:09:51 2019 +0100

    Promote Hg from a debug function to a public one.
    
    A couple of the checks in HgRational::gen_interval are now duplicated
    in the wrapper function that initially vets the arguments, so they can
    be reported up front as clean invocation errors. The final check for
    convergence is reported as a user-facing spigot_error instead of an
    internal_fault. I've added a check for invalid denominator parameters.
    
    Between all those and the syntactic polishing, I think Hg can now be
    safely exposed to ordinary users, so I'm promoting it out of the
    debugging-functions category.

 hypergeom.cpp             | 12 +++++++++---
 manpage.but               |  5 +++++
 manual.but                | 13 +++++++++++++
 python-doc/api.rst        |  2 ++
 python-module/__init__.py | 42 ++++++++++++++++++++++++++++++++++++++++++
 python-module/testsuite   |  1 +
 test.sh                   |  8 ++++++++
 7 files changed, 80 insertions(+), 3 deletions(-)

commit 4703e3e6a5274299236381aeb71b391d670616d8
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=4703e3e6a5274299236381aeb71b391d670616d8;hp=b60d0157c6a6045caf9a9992d7f121f67cd0da63
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Aug 1 19:34:17 2019 +0100

    Permit algebraic() to take rational coefficients.
    
    This has been a FIXME comment for ages, and it's not very hard: our
    system for finding the root of a polynomial over Z is trivially
    extended to polynomials over Q by scaling up the input polynomial
    first.

 algebraic.cpp             | 23 ++++++++++++++++-------
 manpage.but               |  2 +-
 manual.but                |  3 +--
 misc.cpp                  | 15 +++++++++++++++
 python-module/__init__.py | 11 +++++------
 spigot.h                  |  1 +
 test.sh                   |  2 ++
 7 files changed, 41 insertions(+), 16 deletions(-)



More information about the tartarus-commits mailing list