Re: Scheme learning

2018-05-28 Thread Hans Åberg

> On 28 May 2018, at 23:48, Torsten Hämmerle  wrote:
> 
> As far as I know, Church originally used a "hat" accent ^.
> From there, it's not far to a Greek Λ and its lower-case form λ.

In [1], p. 7, there is a remark that he originally stated that, but later said 
the choice was more accidental, a symbol was needed, and λ happened to be 
chosen.

1. 
https://github.com/aistrate/Articles/blob/master/Haskell/History%20of%20Lambda-calculus%20and%20Combinatory%20Logic%20(Cardone%2C%20Hindley).pdf



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Scheme learning

2018-05-28 Thread Torsten Hämmerle
Hans Åberg-2 wrote
> The lambda comes from the book by Alonzo Church, "The Calculi of
> Lambda-conversion", which is a logic theory about function applications,
> but it is unknown why he choose the letter lambda, though a prefix
> notation makes it easier to carry out formal proofs. It then caught on in
> the computer community.

As far as I know, Church originally used a "hat" accent ^.
From there, it's not far to a Greek Λ and its lower-case form λ.

All the best,
Torsten



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Scheme learning

2018-05-28 Thread Hans Åberg


> On 28 May 2018, at 21:47, Robert Schmaus  wrote:
> 
> I agree with you - when I looked at the Scheme functions (mainly as Snippets) 
> I saw that it's not very complicated. It was just when I tried to customise 
> something that I really had to do a lot of guesswork how to get this to work. 
> Does this expression return something or not? What does "lambda" mean, why 
> does this expression need a context and where do I get it from?

The lambda comes from the book by Alonzo Church, "The Calculi of 
Lambda-conversion", which is a logic theory about function applications, but it 
is unknown why he choose the letter lambda, though a prefix notation makes it 
easier to carry out formal proofs. It then caught on in the computer community.

Instead of a prefix lambda notation, one can use the infix "mapsto" notation, 
and there are some examples here:
  https://en.wikipedia.org/wiki/Lambda_calculus



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Scheme learning

2018-05-28 Thread Robert Schmaus

Hi Andrew,

thanks first of all for your mail and the many resources (which I will 
need some time to look through, I think) ... and sorry for the late 
reply, I had two computer-free days, which sometimes really is refreshing.


I agree with you - when I looked at the Scheme functions (mainly as 
Snippets) I saw that it's not very complicated. It was just when I tried 
to customise something that I really had to do a lot of guesswork how to 
get this to work. Does this expression return something or not? What 
does "lambda" mean, why does this expression need a context and where do 
I get it from?


Just to illustrate what I mean: To get a bar number, one needs to use 
the apply context function. In the documentation, there's this:


\applyContext
  #(lambda (x)
(format #t "\nWe were called in barnumber ~a.\n"
 (ly:context-property x 'currentBarNumber)))

So, (ly:context-property x 'currentBarNumber) returns the bar number, 
clear enough. But how do I get it outside the lambda thing? Replacing 
the format directive with a define directive doesn't work because bnum 
is not know outside.


\applyContext
  #(lambda (x)
(define bnum (ly:context-property x 'currentBarNumber)))
\set Score.currentBarNumber = #bnum

Defining the variable outside and assigning a value inside throws no 
error but the value in the last line is 0


#(define bnum 0)
\applyContext
  #(lambda (x)
(set! bnum (ly:context-property x 'currentBarNumber)))
\set Score.currentBarNumber = #bnum

In this way, I fiddle around, sometimes I got it to work sometimes not 
and in either case I don't really have a clue why.


So anyway, as you might have seen, Urs sent me a link to a 
lilypond-specific Scheme manual that he started - I guess I'll work my 
way through that (as well as the "Extending Lilypond" manual) first. 
Maybe then I'm even really hooked to see more of Scheme, who knows ...


That Scheme people are a frienly lot is something I noticed right away!
So thanks again for your encouragement and resources - I really 
appreciate it!


Best,
Robert

PS "Teach Youself Scheme in Fixnum Days" is a great title, by the way ...



Am 27.05.18 um 13:38 schrieb Andrew Bernard:

Hi Robert,

I've started a new thread on the topic under discussion of the 
difficulty of learning Scheme. This comes up frequently. Putting my 
programmer hat on, it's a common experience for programmers brought up 
in C family languages to be baffled and daunted by Scheme and Lisp 
family languages. But it's worth noting that MIT taught Scheme as the 
fundamental undergraduate computer language for many, many years. This 
is because the insight Scheme gives one into computer science thinking 
is really valuable, no matter what language you may go on to later. MIT 
sadly now teaches Python instead. There are a large number of people 
that regard this as a mistake and a decline in educational quality, mere 
vocational training.


The thing about Lisp and Scheme is that there is so little syntax that 
you can pick it up in an hour. As for all the nested parentheses, any 
decent editor (ahem, emacs...) handles the brackets and indenting for 
you, leading to readable code and ease of typing. It;s the conceptual 
shift that people find difficult. But really, putting in an initial 
effort invariably leads to an epiphany related by all Lisp programmers, 
where one day you just _get it_. It's an interesting experience. After 
that, you regard the world differently.


The fantastic thing about lilypond is that it is extensible with Scheme, 
and that makes Scheme definitely worth learning of you want to do 
sophisticated things with lilypond. GNU had a concept of use Scheme as 
an extension language for its whole ecosystem, and this is why Guile was 
created. This never really took off, but lilypond is one of the shining 
examples of this GNU concept.


Scheme as Guile in the context of lilypond can be complex, because it is 
a highly domain specific environment, but Scheme people are a friendly 
lot in general and there are many learned colleagues on the list willing 
to help, and there are no stupid questions (except maybe those lacking 
an MWE :-)). I really feel the investment in time improves your work in 
non Lisp languages, gives you a foothold in Functional Programming, and 
allows you to take the out of the box already superb lilypond output to 
even more refined heights. I cant think of any downside except the time 
invested - but it's just so worthwhile.


As to learning materials, each person will have their own 
recommendations. I would recommend obtaining a copy of SICP, Structure 
and Interpretation of Computer Programs, by Ableson and Sussman, the MIT 
text and classic of computer science. This is the famous Wizard book, 
from the cover picture. My hardback copy sits on my bookshelf near me 
just to give daily inspiration. Although out of print, the full text is 
available on the web:


https://mitpress.mit.edu/sites/default/files/sicp/index.html


Re: Scheme learning

2018-05-28 Thread David Kastrup
Robert Schmaus  writes:

> Hi Andrew,
>
> thanks first of all for your mail and the many resources (which I will
> need some time to look through, I think) ... and sorry for the late
> reply, I had two computer-free days, which sometimes really is
> refreshing.
>
> I agree with you - when I looked at the Scheme functions (mainly as
> Snippets) I saw that it's not very complicated. It was just when I
> tried to customise something that I really had to do a lot of
> guesswork how to get this to work. Does this expression return
> something or not? What does "lambda" mean, why does this expression
> need a context and where do I get it from?
>
> Just to illustrate what I mean: To get a bar number, one needs to use
> the apply context function. In the documentation, there's this:
>
> \applyContext
>   #(lambda (x)
> (format #t "\nWe were called in barnumber ~a.\n"
>  (ly:context-property x 'currentBarNumber)))
>
> So, (ly:context-property x 'currentBarNumber) returns the bar number,
> clear enough.

Given a context x, evaluated at the time where the \applyContext call is
"iterated".

> But how do I get it outside the lambda thing?

There is no current bar number outside of iteration (the interpretation
of a music expression in the sequence of musical time).

> Replacing the format directive with a define directive doesn't work
> because bnum is not know outside.
>
> \applyContext
>   #(lambda (x)
> (define bnum (ly:context-property x 'currentBarNumber)))
> \set Score.currentBarNumber = #bnum

You can use set! for setting global variables (to be defined at global
scope) but it seems nonsensical to store stuff in a variable instead of
just setting that property.

So something like
\applyContext
  #(lambda (current-context)
(set! (ly:context-property (ly:context-find current-context 'Score)
   'currentBarNumber)
  (ly:context-property current-context 'currentBarNumber)))


> Defining the variable outside and assigning a value inside throws no
> error but the value in the last line is 0

> #(define bnum 0)
> \applyContext
>   #(lambda (x)
> (set! bnum (ly:context-property x 'currentBarNumber)))
> \set Score.currentBarNumber = #bnum

Well, \applyContext and \set are called at the same point of musical
time.  \set is worked on during the start of time step (so that the
settings it establishes are present for other commands) while
\applyContext has its workload defined for the "process-music" stage.
Which means that stuff like the Timing_translator have already run.
Also, \set has completed.  Probably not the most intuitive behavior.

Not actually related to Scheme but rather to the order LilyPond
internals process music.

> In this way, I fiddle around, sometimes I got it to work sometimes not
> and in either case I don't really have a clue why.

Well, to be fair, in this particular case I'll readily admit that
"obvious" is not really a proper description of what happens.

Most of what you guessed was quite right but you weren't able to
appreciate that because of the final spanner in the works (the execution
order) that had rather little to do with your deductions.

> So anyway, as you might have seen, Urs sent me a link to a
> lilypond-specific Scheme manual that he started - I guess I'll work my
> way through that (as well as the "Extending Lilypond" manual)
> first. Maybe then I'm even really hooked to see more of Scheme, who
> knows ...

It won't help for the quirks of this particular case.  I admit I looked
in the code for the details of \applyContext, mostly because I am too
lazy to look in places I know my way around less.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re:Lilypond is not generating a pdf file (foxfanfare)

2018-05-28 Thread Michael Gerdau
I can confirm this rule would have at least one exception.

Kind regards
Michael 

Mobil gesendet

> Am 28.05.2018 um 18:17 schrieb Carl Sorensen :
> 
> From: Peter Gentry 
> Date: Monday, May 28, 2018 at 3:18 AM
> To: 
> Subject: . Re:Lilypond is not generating a pdf file (foxfanfare)
>  
> This may/may not be relevant. The problem may be down to the way the 
> temporary files are handled. I have seen it a few times. To be honest I 
> cannot remember how I resolved it. There seems to be some link to the 
> temporary file that using fresco can be cleared by closing all the files and 
> Fresco and starting again. Windows and Windows 10 can be a bit mysterious in 
> the way it handles files and their links.
>  
> Hope this is relevant
>  
> It seems to me like sometime in the past LilyPond didn’t work with Windows 10 
> if it was installed for all users, but did work if it was installed for a 
> single user.  But that recollection may not be accurate.
>  
> Carl
>  
>  
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: . Re:Lilypond is not generating a pdf file (foxfanfare)

2018-05-28 Thread Carl Sorensen
From: Peter Gentry 
Date: Monday, May 28, 2018 at 3:18 AM
To: 
Subject: . Re:Lilypond is not generating a pdf file (foxfanfare)

This may/may not be relevant. The problem may be down to the way the temporary 
files are handled. I have seen it a few times. To be honest I cannot remember 
how I resolved it. There seems to be some link to the temporary file that using 
fresco can be cleared by closing all the files and Fresco and starting again. 
Windows and Windows 10 can be a bit mysterious in the way it handles files and 
their links.

Hope this is relevant

It seems to me like sometime in the past LilyPond didn’t work with Windows 10 
if it was installed for all users, but did work if it was installed for a 
single user.  But that recollection may not be accurate.

Carl


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Lilypond is not generating a pdf file

2018-05-28 Thread Brian Barker

At 06:57 28/05/2018 -0700, Aaron Hill wrote:

At 08:07 27/05/2018 +, Peter Horan wrote:
I have previously used Lilypond on an older machine using Vista. 
This machine is new, running Windows 10. After installation, 
dropping test.ly onto the Lilypond short cut creates a test.log 
file but no pdf file as expected. It looks as though Lilypond is 
silently quitting before drawing everything.


The contents of test.log are:
# -*-compilation-*-
Processing `D:/Peter/Desktop/test.ly'
Parsing...
Interpreting music...
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...


The closest similar behavior I have seen to this is when I am trying 
to regenerate a PDF but that PDF is currently open in another 
program. Then due to a sharing violation, LilyPond is unable to 
write to the file.


Indeed so. But, for the avoidance of doubt, when this happens, my 
Lilypond under Windows 10 shows four more lines in the log file, 
including one explaining that Ghostscript failed to create the PDF 
file - and anyway leaves behind the intermediate Postscript file.


Brian Barker 



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: lilypond-user Digest, Vol 186, Issue 108

2018-05-28 Thread Lukas-Fabian Moser



Another possible approach, for the temporary time changes, is can you
display the new time signature without actually setting it? (Ie if the
piece is in 2/4, you display 3/4 but lilypond still thinks its a 2/4 bar
as before with no change.

Then just use \times 2/3 {} for that bar so the notation displays correctly.

Okay, that won't work for midi, but for scores it might be a good solution.

This can also be done without \times or \scaleDurations in a 
"semantically correct" way (assuming that the length of a quarter note 
should remain unchanged):


\version "2.19.80"

\relative {
  \time 3/4
  a b c
  \set Score.measureLength = #(ly:make-moment 5 4)
  d c d c b
  a b c d e
  \set Score.measureLength = #(ly:make-moment 3 4)
  a b c
  d e c
}

Best
Lukas

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Lilypond is not generating a pdf file

2018-05-28 Thread Aaron Hill

On 2018-05-27 01:07, Peter Horan wrote:

I have previously used Lilypond on an older machine using Vista.

This machine is new, running Windows 10.

After installation, dropping test.ly onto the Lilypond short cut
creates a test.log file but no pdf file as expected.  It looks as
though Lilypond is silently quitting before drawing everything.


Hi Peter,

Which version of LilyPond did you install?  Also, if you run "winver", 
what exact build of the OS are you using?


The closest similar behavior I have seen to this is when I am trying to 
regenerate a PDF but that PDF is currently open in another program.  
Then due to a sharing violation, LilyPond is unable to write to the 
file.  However, in your case, you are never getting a PDF at all, but 
that could still imply the target folder might be an invalid 
destination.


NOTE: I never use drag-and-drop method as you mentioned.  LilyPond 
installs a default shell command for .ly files, so you can either just 
double-click them or right-click and select "Generate".  There shouldn't 
really be any major difference in behavior here, but I thought I would 
mention this for completeness.


If you want to debug further, I might suggest running Process Monitor 
[1] from Sysinternals.  It will capture a lot of data, but you can 
filter it down to just the relevant file I/O.  Most importantly, what 
you are looking for is to see if LilyPond (or one of its child 
processes) is actually attempting to open a PDF for write, and if so 
what error may have occurred.


[1]: https://docs.microsoft.com/en-us/sysinternals/downloads/procmon

-- Aaron Hill

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: lilypond-user Digest, Vol 186, Issue 108

2018-05-28 Thread Aaron Hill

On 2018-05-28 06:00, Wols Lists wrote:

On 22/05/18 21:11, Arle Lommel wrote:
lmost right, but doesn’t function quite as Hindemith’s

notation does:

  * The Hindemith editions use time signatures /both/ above and in 
line,

but never at the same time. They serve different purposes. The
snipped removes the ability to do the in-line time signatures
because the time signature engraver is removed from the main 
staffs.

Easy enough to put in, but then I need to brush up enough to
selectively control where a time signature appears
  * Hindemith also limits the effect of a superior time signature to a
single measure. The following measure reverts (with nothing
displayed) to the original meter. So replicating the Schott 
practice
would mean also hiding the time signature following such a 
measure.



But this is very useful as a suggestion of an approach. Maybe I can 
find
a way to selectively hide/show time signature changes in each context 
to

get what I want.


Another possible approach, for the temporary time changes, is can you
display the new time signature without actually setting it? (Ie if the
piece is in 2/4, you display 3/4 but lilypond still thinks its a 2/4 
bar

as before with no change.

Then just use \times 2/3 {} for that bar so the notation displays 
correctly.


Okay, that won't work for midi, but for scores it might be a good 
solution.


You could do a hidden tempo change for the MIDI output that would 
correct for the scaled durations.


But I would think the best option is not to mess with scaled durations 
and simply have an actual time signature change.  All you need to do is 
visually offset the normal time signature, or you can hide it and simply 
replace it with suitable markup.  There was a recent thread on this:


http://lists.gnu.org/archive/html/lilypond-user/2018-05/msg00403.html

What could be handy, perhaps, is to have the ability to do a time 
signature change that is limited to a defined scope.  Consider the 
following:



  \version "future"
  {
\time 3/4 % Normal time signature change
a4 b c' | e'2 d'
\localtime 5/4 % Scoped time signature change
{
   e'4 g'8 f' e' d' e'2
}
% Time signature implicitly reverts to 3/4 here
c'4 b g | a2.
  }


Providing these so-called local time signature changes would be 
adjustable/overridable independently of normal ones, folks could easily 
accommodate something like Hindemith.


-- Aaron Hill

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: lilypond-user Digest, Vol 186, Issue 108

2018-05-28 Thread David Kastrup
Wols Lists  writes:

> On 22/05/18 21:11, Arle Lommel wrote:
> lmost right, but doesn’t function quite as Hindemith’s
>> notation does:
>> 
>>   * The Hindemith editions use time signatures /both/ above and in line,
>> but never at the same time. They serve different purposes. The
>> snipped removes the ability to do the in-line time signatures
>> because the time signature engraver is removed from the main staffs.
>> Easy enough to put in, but then I need to brush up enough to
>> selectively control where a time signature appears
>>   * Hindemith also limits the effect of a superior time signature to a
>> single measure. The following measure reverts (with nothing
>> displayed) to the original meter. So replicating the Schott practice
>> would mean also hiding the time signature following such a measure.
>> 
>> 
>> But this is very useful as a suggestion of an approach. Maybe I can find
>> a way to selectively hide/show time signature changes in each context to
>> get what I want.
>> 
> Another possible approach, for the temporary time changes, is can you
> display the new time signature without actually setting it? (Ie if the
> piece is in 2/4, you display 3/4 but lilypond still thinks its a 2/4 bar
> as before with no change.
>
> Then just use \times 2/3 {} for that bar so the notation displays correctly.

You mean \scaleDurations ?

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: lilypond-user Digest, Vol 186, Issue 108

2018-05-28 Thread Wols Lists
On 22/05/18 21:11, Arle Lommel wrote:
lmost right, but doesn’t function quite as Hindemith’s
> notation does:
> 
>   * The Hindemith editions use time signatures /both/ above and in line,
> but never at the same time. They serve different purposes. The
> snipped removes the ability to do the in-line time signatures
> because the time signature engraver is removed from the main staffs.
> Easy enough to put in, but then I need to brush up enough to
> selectively control where a time signature appears
>   * Hindemith also limits the effect of a superior time signature to a
> single measure. The following measure reverts (with nothing
> displayed) to the original meter. So replicating the Schott practice
> would mean also hiding the time signature following such a measure.
> 
> 
> But this is very useful as a suggestion of an approach. Maybe I can find
> a way to selectively hide/show time signature changes in each context to
> get what I want.
> 
Another possible approach, for the temporary time changes, is can you
display the new time signature without actually setting it? (Ie if the
piece is in 2/4, you display 3/4 but lilypond still thinks its a 2/4 bar
as before with no change.

Then just use \times 2/3 {} for that bar so the notation displays correctly.

Okay, that won't work for midi, but for scores it might be a good solution.

Cheers,
Wol

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


. Re:Lilypond is not generating a pdf file (foxfanfare)

2018-05-28 Thread Peter Gentry
This may/may not be relevant. The problem may be down to the way the
temporary files are handled. I have seen it a few times. To be honest I
cannot remember how I resolved it. There seems to be some link to the
temporary file that using fresco can be cleared by closing all the files and
Fresco and starting again. Windows and Windows 10 can be a bit mysterious in
the way it handles files and their links.

 

Hope this is relevant

 

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user