lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: helper function that should take a list argument doesn't do anything


From: David Kastrup
Subject: Re: helper function that should take a list argument doesn't do anything
Date: Fri, 09 Nov 2012 23:31:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

Janek Warchoł <address@hidden> writes:

> On Thu, Nov 8, 2012 at 9:21 AM, David Kastrup <address@hidden> wrote:
>> First, let's assume 2.16 (the current development version will not
>> accept the above syntax of \overrideProperty even in the first variant).
>
> Yes.  I haven't made the switch yet.
>
>> Then inside of # itself, like with #'((alignement-distances ..., # has
>> only Scheme meanings, like #t, #f, #(2 3 4) (a literal vector), #{
>> ... #} (embedded LilyPond), #\? (a character constant).  #' is not
>> anything it recognizes I think.
>
> Well, i don't quite understand why
>
> manualBeam =
> #(define-music-function
>      (parser location beg-end)
>      (pair?)
>    #{
>      \once \override Beam #'positions = #beg-end
>    #})
>
> works then.

Here #' is inside of LilyPond code, not inside of Scheme code.  #
switches from LilyPond to Scheme, #{ from Scheme to LilyPond.  # in
LilyPond is followed by _one_ Scheme expression, like 'positions or like
beg-end.

> But nevermind, you don't have to explain this.  I'd just want to say
> that from a user's perspective it's very frustrating that i cannot
> simply copy-and-paste some valid lilypond code into #{ #}

You did not copy and paste valid LilyPond code into #{ #}.  You replaced
a constant in a constant list by a symbol.  That was not valid outside
of #{ #}, and it did not became valid inside of it.

> and have it work, especially when some similar code works without any
> problems.  I hope that you know how to improve this situation
> somewhere in the future.

Absolutely nothing I can do here.  The Scheme interpreter and Scheme
syntax is a given.  Once you are inside of Scheme, your only resourse is
complaining to the Guile developers, and it is not particularly likely
that they will be overly impressed when the problem is due to a
misunderstanding of Scheme.

>> or quasi-quoting (backtick at the start, evaluated stuff with , before
>> it), like
>> #`((alignment-distances . ,distances))
>> I am not entirely sure that . , is accepted, but if it isn't,
>> #`((alignment-distances ,@distances))
>> should do the trick instead (,@ is the list splicing operator, basically
>> stripping one level of parens when inserting).
>
> looks like black magic to me.

' and ` are explained in pretty much every Lisp or Scheme manual or
introduction.  Quoting stops Scheme from _evaluating_ an expression, and
a variable name that is not evaluated is just a symbol without any
connection to a value.  Only when evaluated (so outside of quoting) is
the variable and value corresponding to a symbol looked up.

> But nevertheless, thanks for your explanations; i do appreciate them.
> Sorry for being grumpy - i'm frustrated with some other things, for
> example the fact that all my data got deleted because of a script bug,

Checking into git occasionally makes things easier.

> and the fact that the behaviour of 'rm' makes it very difficult to
> recover anything.

touch ./-i

is a trick from old times that helps against things like writing

rm * .o

accidentally.  It is not overly effective: checking everything
occasionally into git tends to be more thorough.

-- 
David Kastrup



reply via email to

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