Re: Having trouble understanding optional and variable amount of arguments

2018-03-09 Thread Urs Liska
Hi Stéfano, Am 09.03.2018 um 16:48 schrieb Stefano Troncaro: A few thoughts I think macro definitions for all the define- functions can be avoided like this: \version "2.19.80" \include "oll-core/package.ily" #(define-macro (with-options func-def-proc vars preds rulings . body)

Re: Having trouble understanding optional and variable amount of arguments

2018-03-09 Thread Stefano Troncaro
A few thoughts I think macro definitions for all the define- functions can be avoided like this: > \version "2.19.80"\include "oll-core/package.ily" > #(define-macro (with-options func-def-proc vars preds rulings . body) >`(,func-def-proc ,(append '(opts) vars) ,(append '(ly:context-mod?)

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Urs Liska
@Urs I've thought about this some more. I don't know if you were interested in wrapping the functions that use opts and props in a macro, but I noticed a lot of redundancy so I gave it a try. \version "2.19.80" \include "oll-core/package.ily" #(define-macro

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Urs Liska
Am 08.03.2018 um 23:46 schrieb Stefano Troncaro: @Urs With your last update, the following syntax popped to mind: \version "2.19.80" %Functional copy of your example #(define rules `(strict (req payload (target ,symbol?)) (opt

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Stefano Troncaro
@Harm I can't imagine how frustrating it must have been to try to upgrade from 1.8, ~5 years is so much time! Indeed, the changes from 1.8 to 2 must be very deep... Thank you for taking the time to explain that, I found it very interesting. @Urs I've thought about this some more. I don't know if

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Thomas Morley
2018-03-08 23:46 GMT+01:00 Stefano Troncaro : > @David, Harm > I didn't know 1.8 was not maintained anymore. I imagine we're still using it > because updating it would take a lot of work (and create instability) and > dev time is better placed elsewhere, or something

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Stefano Troncaro
@Urs With your last update, the following syntax popped to mind: > \version "2.19.80" > %Functional copy of your example#(define rules >`(strict > (req payload >(target ,symbol?)) > (opt accepted-without-type >(accepted-arg ,fraction?) >(ind

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread David Kastrup
Thomas Morley writes: > 2018-03-08 17:29 GMT+01:00 David Kastrup : >> Stefano Troncaro writes: >> >>> @David >>> Thank you. The define-syntax and syntax-rules thing looked easier to >>> understand at first glance so I tried to

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Thomas Morley
2018-03-08 17:29 GMT+01:00 David Kastrup : > Stefano Troncaro 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

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread David Kastrup
Stefano Troncaro 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

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Urs Liska
Am 08.03.2018 um 16:52 schrieb Urs Liska: @Urs Great! I tested it a bit and it seems to be working as intended. I have forgotten one thing that I've only halfway completed by now: "accepted" properties without type checking. Currently, if the "strict" flag is set, only keys present in the

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Urs Liska
Am 08.03.2018 um 16:42 schrieb Stefano Troncaro: @Urs Great! I tested it a bit and it seems to be working as intended. I have forgotten one thing that I've only halfway completed by now: "accepted" properties without type checking. Currently, if the "strict" flag is set, only keys present

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Stefano Troncaro
@Urs Great! I tested it a bit and it seems to be working as intended. I'm curious about the "complains about the wrong type for 'target'" part though. I remembered that words when typed like that were symbols, so I did this to check it out: > \version "2.19.80"\include

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Urs Liska
Am 08.03.2018 um 10:35 schrieb Urs Liska: Am 08.03.2018 um 08:44 schrieb Urs Liska: Hi Stéfano, Am 08.03.2018 um 07:26 schrieb Stefano Troncaro: @Urs I looked into your examples and \with blocks are very useful. You said earlier that you were thinking about how to make it so that the

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Urs Liska
Am 08.03.2018 um 08:44 schrieb Urs Liska: Hi Stéfano, Am 08.03.2018 um 07:26 schrieb Stefano Troncaro: @Urs I looked into your examples and \with blocks are very useful. You said earlier that you were thinking about how to make it so that the context-mod could have required arguments,

Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread David Kastrup
Stefano Troncaro writes: > First of all, I apologize for the delayed response, I wanted to write back > earlier but I couldn't find the time to delve into your last suggestions. > Thank you for the useful replies! > > @Harm > I don't understand most of what the code

Re: Having trouble understanding optional and variable amount of arguments

2018-03-07 Thread Urs Liska
Hi Stéfano, Am 08.03.2018 um 07:26 schrieb Stefano Troncaro: @Urs I looked into your examples and \with blocks are very useful. You said earlier that you were thinking about how to make it so that the context-mod could have required arguments, default values for missing ones, and even

Re: Having trouble understanding optional and variable amount of arguments

2018-03-07 Thread Stefano Troncaro
First of all, I apologize for the delayed response, I wanted to write back earlier but I couldn't find the time to delve into your last suggestions. Thank you for the useful replies! @Harm I don't understand most of what the code you provided is doing, only that it works. It's far too advanced

Re: Having trouble understanding optional and variable amount of arguments

2018-03-03 Thread Thomas Morley
2018-03-01 18:31 GMT+01:00 Stefano Troncaro : > I didn't know about \default or the dot/comma separated number/symbol lists! > I can see those being useful in some circumstances. I was thinking about > cases where an undefined amount of things different than symbols or

Re: Having trouble understanding optional and variable amount of arguments

2018-03-01 Thread Urs Liska
Am 01.03.2018 um 18:31 schrieb Stefano Troncaro: ... @Urs, I not familiar with \with blocks, I'll take a look at the oll-core code and experiment a bit with it. Maybe I'll be able to help. Look at https://github.com/openlilylib/scholarly/blob/master/usage-examples/annotate.ly to see an

Re: Having trouble understanding optional and variable amount of arguments

2018-03-01 Thread Urs Liska
Am 01.03.2018 um 18:31 schrieb Stefano Troncaro: ... @Urs, I not familiar with \with blocks, I'll take a look at the oll-core code and experiment a bit with it. Maybe I'll be able to help. Look at https://github.com/openlilylib/scholarly/blob/master/usage-examples/annotate.ly to see an

Re: Having trouble understanding optional and variable amount of arguments

2018-03-01 Thread Stefano Troncaro
I didn't know about \default or the dot/comma separated number/symbol lists! I can see those being useful in some circumstances. I was thinking about cases where an undefined amount of things different than symbols or numbers are required, and the closest I can imagine is chaining functions to

Re: Having trouble understanding optional and variable amount of arguments

2018-02-28 Thread David Kastrup
Stefano Troncaro writes: > Thank you! I see that this is not an option then. Also, I now understand > why I couldn't make the optional arguments work, since I always left them > for last. > > Do you know if it is possible to have a flexible amount of optional >

Re: Having trouble understanding optional and variable amount of arguments

2018-02-28 Thread David Kastrup
Stefano Troncaro writes: > Thank you! I see that this is not an option then. Also, I now understand > why I couldn't make the optional arguments work, since I always left them > for last. You can use an explicit \default to substitute optional arguments in final

Re: Having trouble understanding optional and variable amount of arguments

2018-02-28 Thread Urs Liska
Am 1. März 2018 03:26:31 MEZ schrieb Stefano Troncaro : >Thank you! I see that this is not an option then. Also, I now >understand >why I couldn't make the optional arguments work, since I always left >them >for last. > >Do you know if it is possible to have a

Re: Having trouble understanding optional and variable amount of arguments

2018-02-28 Thread Stefano Troncaro
Thank you! I see that this is not an option then. Also, I now understand why I couldn't make the optional arguments work, since I always left them for last. Do you know if it is possible to have a flexible amount of optional arguments that appear before the last mandatory one? Say, for example

Re: Having trouble understanding optional and variable amount of arguments

2018-02-28 Thread Simon Albrecht
On 28.02.2018 23:54, Stefano Troncaro wrote: I need a little help again. I'm struggling to understand how one would make a music function like \tempo, that accepts a variable number of arguments. I couldn't find its definition so I couldn't look for myself. So far I know about making lambdas

Re: Having trouble understanding optional and variable amount of arguments

2018-02-28 Thread Caagr98
I think \tempo (and a few other commands such as \repeat\alternative, \set, and \override) are hardcoded in the Lilypond compiler using methods not accessible through Scheme, so you can't make that kind of functions yourself. You can make functions with optional arguments, though. I think the

Having trouble understanding optional and variable amount of arguments

2018-02-28 Thread Stefano Troncaro
Hello everyone, I need a little help again. I'm struggling to understand how one would make a music function like \tempo, that accepts a variable number of arguments. I couldn't find its definition so I couldn't look for myself. So far I know about making lambdas that take additional arguments