lilypond-devel
[Top][All Lists]
Advanced

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

Re: Add the command \offset to LilyPond (issue 8647044)


From: dak
Subject: Re: Add the command \offset to LilyPond (issue 8647044)
Date: Fri, 04 Oct 2013 05:59:15 +0000


https://codereview.appspot.com/8647044/diff/5001/scm/music-functions.scm
File scm/music-functions.scm (right):

https://codereview.appspot.com/8647044/diff/5001/scm/music-functions.scm#newcode2103
scm/music-functions.scm:2103: ; head of the alist.  We reverse the alist
so our search will return
On 2013/04/25 13:48:55, david.nalesnik wrote:
On 2013/04/23 22:09:04, dak wrote:
> On 2013/04/23 20:24:57, dak wrote:


> "If our search returns an anonymous procedure" is quite strained.
We don't
need
> to _speculate_ about the identity of the anonymous procesure.  If we
want to
be
> sure, we can just remember it:
>
> (define (offsetter property offsets)
>   (define (self grob)

In view of the way offsetter is called, the first line of the above
would still
need to be
(define ((offsetter property offsets) grob)

Not at all.

I see the value of the procedure recognizing itself, but I'm afraid I
don't
understand how to implement this from the start you've given me.
Could you give
me a further hint as to what

(define (self grob) ...

would contain?

The same as it does now, except that it can compare the callbacks in
the alist to "self" with "eq?".

It is probably more interesting how the function offsetter is then
ended:

(define (offsetter property offsets)
  (define (self grob) .............)
  self)

The basics, namely having a function returning a function (or rather a
closure since it uses "property" and "offsets" internally) remain the
same.  It is just that the closure is no longer anonymous but rather
called "self" (or whatever else) and thus is able to recognize itself.

https://codereview.appspot.com/8647044/



reply via email to

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