Menu

#4487 Implement partial function calls.

Verified
nobody
Enhancement
2015-07-27
2015-07-09
Anonymous
No

Originally created by: *anonymous

Originally created by: dak@gnu.org
Originally owned by: dak@gnu.org

Implement partial function calls.

Contains two commits, see particularly the regtest as an example.

I'm not convinced this idea is as good as I thought when coming up
with it: it may be that this particular use case is not frequent
enough to warrant the complexity.

It seems nice for defining aliases like

tagv = \tag '(violinI violinII) \incomplete

or

important = \tweak color #red \tweak font-size 3 \incomplete

but I'm not sure that this warrants the effort.

Discuss.

Allow for chaining of several partial functions in a row

Chaining only works when all function calls except the last one have all
arguments supplied already, with their last argument being the rest of
the chained call.

Implement partial function calls

A partial function call acts as a function where the start of the
argument list has already been supplied.  For example:

makeRed = \tweak color #red \incomplete

Then one can use this as

{ c' \makeRed d' e'-\makeRed -. }

http://codereview.appspot.com/249670043

Related

Issues: #4505

Discussion

  • Google Importer

    Google Importer - 2015-07-09

    Originally posted by: lemzw...@googlemail.com

    I like it, it's a very nice idea!  However, only real-world tests will show whether it is useful in the general case.

    LGTM

     
  • Google Importer

    Google Importer - 2015-07-10

    Originally posted by: pkx1...@gmail.com

    Passes make, make check and a full make doc.

    Labels: -Patch-new Patch-review

     
  • Google Importer

    Google Importer - 2015-07-10

    Originally posted by: dak@gnu.org

    Issue 4487/3: Implement partial markups

    A partial markup acts as a chain of markup commands where everything but
    the final markup has already been supplied.

    For example:

    bold-red-markup = \markup \bold \with-color #red \incomplete

    \markup \bold-red "text"
    \markuplist \column-lines \bold-red { One Two Three }

    Please note that in order for \markup to recognize the resulting markup
    command inside of markup expressions, the identifier to which the
    resulting markup command is assigned needs to have "-markup" appended to
    its name: LilyPond encodes markup command names in this manner so that
    markup commands can use the same name as other entities outside of
    markup mode.

    Note also that this will not work with the markup macro since the latter
    additionally requires the definition of a suitable make-bold-red-markup
    command.

    http://codereview.appspot.com/249670043

    Labels: -Patch-review Patch-new

     
  • Google Importer

    Google Importer - 2015-07-10

    Originally posted by: pkx1...@gmail.com

    Passes make, make check and a full make doc

    Labels: -Patch-new Patch-review

     
  • Google Importer

    Google Importer - 2015-07-13

    Originally posted by: pkx1...@gmail.com

    Patch on countdown for July 18th

    Labels: -Patch-review Patch-countdown

     
  • Google Importer

    Google Importer - 2015-07-17

    Originally posted by: pkx1...@gmail.com

    Patch counted down - please push

    Labels: -Patch-countdown Patch-push

     
  • Google Importer

    Google Importer - 2015-07-17

    Originally posted by: dak@gnu.org

    Pushed to staging as
    commit [rf4bbf51329c0594b55ae7fa28a831ec700c9d2e7]
    Author: David Kastrup <dak@gnu.org>
    Date:   Sun Jul 12 11:59:04 2015 +0200

        Issue 4487/4: add Changes entry for \etc

    commit [r1fb0cec0362ad8c6d2468c33af3bdd4d5bef827a]
    Author: David Kastrup <dak@gnu.org>
    Date:   Sun Jun 15 14:12:34 2014 +0200

        Issue 4487/3: Implement partial markups
       
        A partial markup acts as a chain of markup commands where everything but
        the final markup has already been supplied.
       
        For example:
       
        bold-red-markup = \markup \bold \with-color #red \etc
       
        \markup \bold-red "text"
        \markuplist \column-lines \bold-red { One Two Three }
       
        Please note that in order for \markup to recognize the resulting markup
        command inside of markup expressions, the identifier to which the
        resulting markup command is assigned needs to have "-markup" appended to
        its name: LilyPond encodes markup command names in this manner so that
        markup commands can use the same name as other entities outside of
        markup mode.
       
        Note also that this will not work with the markup macro since the latter
        additionally requires the definition of a suitable make-bold-red-markup
        command.

    commit [rb579529b5f3f89a5b8a17760bb199b0eacc671be]
    Author: David Kastrup <dak@gnu.org>
    Date:   Thu Jul 9 14:54:14 2015 +0200

        Issue 4487/2: Allow for chaining of several partial functions in a row
       
        Chaining only works when all function calls except the last one have all
        arguments supplied already, with their last argument being the rest of
        the chained call.

    commit [r61c40c765eea03bc1029b596a2d31ab70f26d82c]
    Author: David Kastrup <dak@gnu.org>
    Date:   Tue Jul 7 21:44:59 2015 +0200

        Issue 4487/1: Implement partial function calls
       
        A partial function call acts as a function where the start of the
        argument list has already been supplied.  For example:
       
        makeRed = \tweak color #red \etc
       
        Then one can use this as
       
        { c' \makeRed d' e'-\makeRed -. }

    Labels: -Patch-push Fixed_2_19_24
    Status: Fixed

     
  • Google Importer

    Google Importer - 2015-07-27

    Originally posted by: fedel...@gmail.com

    (No comment was entered for this change.)

    Status: Verified

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.