[Top][All Lists]

[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: Thomas Morley
Subject: Re: How to use optional arguments / parameters in a define-markup-command
Date: Tue, 5 Nov 2019 11:18:39 +0100

Am Di., 5. Nov. 2019 um 09:14 Uhr schrieb Karsten Reincke <address@hidden>:
> On Mon, 2019-11-04 at 23:06 +0100, Thomas Morley wrote:
> > Am Mo., 4. Nov. 2019 um 18:00 Uhr schrieb Karsten Reincke <address@hidden>:
> > [...]
> > Let me quote another part of my reply:
> >
> > Am Fr., 1. Nov. 2019 um 16:01 Uhr schrieb Thomas Morley
> > <address@hidden>:
> >
> > > For variable amount of args I'd go for list? (or the like) and let the
> > > body of your code sort it out.
> >
> > And that's basically what you do in your example-code.
> You are totally correct. Unfortunately, I did not read your mail as 
> thoroughly as
> it should had been done. So, I had to find th solution by myself. But of 
> course.
> it stays your idea.

Well, not my idea, I just pointed to that coding-principle

> >
> > > #(define (assign keyValue assocList defaultValue)
> > >   (string? list?)
> > ^^^^^^^^^^^^^^^^^^
> > As far as I can tell this line is superfluous, returning #f.
> >
> Yep, you are right. Due to the fact, that I later on decided also to allow 
> other
> default values than strings, I erased the third type test without considering 
> that
> then a third type is missed. So it is indeed better to erase the complete 
> line.

You miss the point.
There is no type-checking of this kind in guile-definitions.
The line (string? list?) is an expression of its own, returning #f.
If you try three elements there like in
(define (x a b c) (string? list? string?) (list a b c))
you'll get an error.

Type-checking of this kind is done in _LilyPond's_ functions and for
Don't confuse them.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]