|
From: | Stefano Troncaro |
Subject: | Re: Having trouble understanding optional and variable amount of arguments |
Date: | Thu, 8 Mar 2018 19:46:21 -0300 |
I like it because:\version "2.19.80" %Functional copy of your example #(define rules `(strict (req payload (target ,symbol?)) (opt accepted-without-type (accepted-arg ,fraction?) (ind ,number? 5) (msg ,string? "No message given")))) %Accepts any argument, but provides a type-check and a default for msg #(define rules2 `(flexible (opt (msg ,string? "No message given"))))
Thomas Morley <address@hidden> writes:
> 2018-03-08 17:29 GMT+01:00 David Kastrup <address@hidden>:
>> Stefano Troncaro <address@hidden> writes:
>>
>>> @David
>>> Thank you. The define-syntax and syntax-rules thing looked easier to
>>> understand at first glance so I tried to use that. I'll experiment with
>>> macros then.
>>
>> If we want to get rid of those problems: Guile-1.8 is no longer
>> officially maintained. I think someone forked it for his own purposes.
>> We might want to cooperate with him regarding some official place where
>> one can fix those bugs.
>
> I've tested with my guilev2-lilypond.:
>
> \version "2.21.0"
>
> #(define-syntax test
> (syntax-rules ()
> ((test conditional true false)
> (if conditional
> true
> false))))
>
> #(test #t (display "I'm true!\n") (display "I'm false!\n"))
>
> Works out of the box, no need for (use-syntax (ice-9 syncase)).
> `use-syntax' gives an error now. Obviously it's dropped from guilev2.
Sure, it's been part of Scheme standards for quite a while now.
--
David Kastrup
_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user
[Prev in Thread] | Current Thread | [Next in Thread] |