[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to use optional arguments / parameters in a define-markup-comman
From: |
Karsten Reincke |
Subject: |
Re: How to use optional arguments / parameters in a define-markup-command |
Date: |
Tue, 05 Nov 2019 10:07:33 +0100 |
User-agent: |
Evolution 3.34.1-2 |
On Mon, 2019-11-04 at 23:45 +0000, Urs Liska wrote:
Dear Urs;
many thanks for your comments and hints! I admire how thoroughly you read other
work and how many time you spend with helping others!
> Hi Karsten,
>
> 4. November 2019 17:59, "Karsten Reincke" <address@hidden> schrieb:
> [...]
> > Here is a pure scheme / guile solution using lisp association lists (demoed
> > by
> > using the box example from the extend tutorial).
>
> I see one major issue with your approach: it pollutes the namespace with a
> multitude of global variables.
The global variables are only syntactical sugar. I've attached a version which
does not use any global variable any longer
>
> I don't want to push you towards using openLilyLib ;-) but oll-core includes a
> macro "with-options" (created by Stéfano Troncaro) that allows the
> modification
> of define-music-function (I'm not sure about markup functions right now) so
> that
> the function accepts an optional \with { } clause, performs validation against
> mandatory and optional arguments (optionally along with their types) and can
> provide default values - all without necessarily using #(define XXX) and
> creating global variables.
>
> The code starts here:
> https://github.com/openlilylib/oll-core/blob/master/internal/options.ily#L245
>
This is a nice example using the main feature of LISP: even code can become a
parameter and vice versa. But for my purpose, it is too sophisticated.
> Urs
wit best regards
Karsten
--
Karsten Reincke /\/\ (+49|0) 170 / 927 78 57
Im Braungeröll 31 >oo< mailto:address@hidden
60431 Frankfurt a.M. \/ http://www.fodina.de/kr/
varpara.ly
Description: Text Data