[Top][All Lists]

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

Re: Anything better for delayed lexical evaluation than (lambda () ...)?

From: David Kastrup
Subject: Re: Anything better for delayed lexical evaluation than (lambda () ...)?
Date: Tue, 13 Dec 2011 16:52:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

David Kastrup <address@hidden> writes:

> So I don't think that throwing out _distinguishing_ selling points of
> Guile is necessarily doing you a favor.  And the transparency with
> which it integrates with its language environment and the fact that
> one can continue to use its evaluator and debugger even for the
> application for which it serves as an extension language, certainly is
> a selling point.

To illustrate, take a look at
<URL:>.  How likely do
you consider an average user to write and master such code?

I am currently writing on a report about recent changes in Lilypond, and
the code looks like the following (it does not work yet because
\parallelMusic is not implemented well enough):

ph = #(define-music-function (parser location p1 p2 p3 p4 p5)
       (ly:pitch? ly:pitch? ly:pitch? ly:pitch? ly:pitch?)
       #{ r8 $p3 16 $p4 $p5 $p3 $p4 $p5 |
          r16 $p2 8. ~ $p2 4 |
          $p1 2 |

\parallelMusic #'(high middle low)
        \oneVoice | \voiceOne | \voiceTwo |
        \ph c'   e'  g' c'' e''
        \ph c'   d'  a' d'' f''
        \ph b    d'  g' d'' f''
        \ph c'   e'  g' c'' e''
        \ph c'   e'  a' e'' a''
        \ph c'   d'  fis' a' d''
        \ph d    f   a c' f'  
        \ph g,   d   g b f' 
        \oneVoice | \change Staff = "down" \voiceOne | \voiceTwo |
        \ph c    e   g c' e'  

\score {
  \new PianoStaff
        \context Staff = "up" {
          << \high \\ \middle >>
          r8 f16 a c' f' c' a c' a f a f d f d
          r8 g'16 b' d'' f'' d'' b' d'' b' g' b' d' f' e' d'
          <e' g' c''>1 \bar "|."
        \context Staff = "down" {
          << { r16 c8. ~ c4 ~ c2 r16 b,8. ~ b,4 ~ b,2 c1 }
             \\ { c,2 c, c, c, c,1 } >>
  \midi { \tempo 4 = 80 }
  \layout { }

So what do you see: minimal Schemeishness, minimal complexity.  That's
something a user could actually hope to be writing and understanding.
And this "minimal Schemeishness" in spite of the music function \ph
being actually written in Scheme is exactly the result of making it
seamless and natural to pass in and out of Guile (including taking the
lexical environment or a simulation of it along) to the user.

If the user wanted to primordinarily deal with cryptic languages and
their own data structures and control mechanisms instead of something
approximating music notation, she would be using MusiXTeX.

You may consider this sort of seamless language integration unimportant
because apparently no project but Lilypond has managed approximating it
given the documentation of local-eval (and now substituting an emulation
of it), but at least Lilypond is not yet in the list of applications
trying to get away from Guile for the sake of its users.

David Kastrup

reply via email to

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