simon-git: spigot (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sat Feb 18 16:23:59 GMT 2017


TL;DR:
  9a1c031 Support in principle for unary suffix operators.
  fbd776a Add an operator and function for factorials.
  02095a4 Support braces as variant parens after the ^ operator.

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-02-18 16:23:59

commit 9a1c031551c66d27dd6fbbbbdc6d72902c6f6460
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=9a1c031551c66d27dd6fbbbbdc6d72902c6f6460;hp=40fb8dbe3e529dad0d00a740e731e14dea692b19
Author: Simon Tatham <anakin at pobox.com>
Date:   Sat Feb 18 15:49:03 2017 +0000

    Support in principle for unary suffix operators.
    
    I haven't actually added one yet, but it'll arrive in the next commit.

 expr.cpp | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 57 insertions(+), 15 deletions(-)

commit fbd776a7999a36e0816ff25ee8f20ffee826c186
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=fbd776a7999a36e0816ff25ee8f20ffee826c186;hp=9a1c031551c66d27dd6fbbbbdc6d72902c6f6460
Author: Simon Tatham <anakin at pobox.com>
Date:   Sat Feb 18 15:49:40 2017 +0000

    Add an operator and function for factorials.
    
    These are easy enough to implement, because they're just an
    alternative interface to the gamma function. I hadn't done it before
    because I tended to see factorials as a thing for combinatorial
    integer-valued problems, and if I'm solving one of those then I'm
    probably working entirely in integers and computing in Python rather
    than spigot. But a user commented on their absence, and on reflection,
    factorials come up commonly enough in Taylor series that there
    probably _is_ a case to be made for the usefulness of typing things
    like 'let taylor_error_in_sin(x) = sin(x) - (x - x^3/3! + x^5/5!)'.

 expr.cpp    |  2 ++
 funcs.h     |  1 +
 gamma.cpp   |  6 ++++++
 manpage.but |  8 ++++++++
 manual.but  | 12 +++++++++++-
 test.sh     |  8 ++++++++
 6 files changed, 36 insertions(+), 1 deletion(-)

commit 02095a4e563291d1b4a2fde40cea54e9a3effcde
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=02095a4e563291d1b4a2fde40cea54e9a3effcde;hp=fbd776a7999a36e0816ff25ee8f20ffee826c186
Author: Simon Tatham <anakin at pobox.com>
Date:   Sat Feb 18 16:08:37 2017 +0000

    Support braces as variant parens after the ^ operator.
    
    This is mostly intended to support the existing typing reflexes of
    people used to typing equations in TeX syntax, where you typically
    write 2^{stuff} rather than 2^(stuff) because the former puts the
    whole exponent subexpression into the superscript. I've found myself
    absent-mindedly typing things like 2^{1/7} into spigot enough times
    that I think it's worth making it legal!
    
    However, I'm keeping the scope limited: the use of braces as an
    alternative spelling of parentheses is _only_ permitted immediately
    after the ^ operator. (Not even the ** operator, which is
    _semantically_ synonymous with ^ but doesn't have the same
    justification that anyone is used to typing it with braces
    afterwards.) That should extend the syntax by the minimum amount
    possible.

 expr.cpp | 26 ++++++++++++++++++++++++++
 test.sh  |  1 +
 2 files changed, 27 insertions(+)



More information about the tartarus-commits mailing list