Re: Self-evaluating function and closure

2019-06-17 Thread Mark H Weaver
Hi Vladimir, Vladimir Zhbanov writes: > Great, I've adapted your example to our code and it works > nice. Thank you very much! You're welcome, and I'm glad to hear it :) Best, Mark

Re: Self-evaluating function and closure

2019-06-17 Thread Vladimir Zhbanov
On Sun, Jun 16, 2019 at 07:29:59AM -0400, Mark H Weaver wrote: > Hello again, > > Vladimir Zhbanov writes: > > > scheme@(guile-user)> (define (function-generator) > >(let ((func #f)) > > (lambda () (set! func (let a () a))

Re: Self-evaluating function and closure

2019-06-17 Thread Vladimir Zhbanov
Hi Mark, John, My fault, sorry. In a fresh session there is no toplevel definition of the function defined by 'let'. Looking through Geiser history I found "(define a $9)". Probably this was the culprit. My apologies and thank you for your help! -- Vladimir (λ)επτόν EDA — https://github.com/l

Re: Self-evaluating function and closure

2019-06-16 Thread Mark H Weaver
Hello again, Vladimir Zhbanov writes: > scheme@(guile-user)> (define (function-generator) >(let ((func #f)) > (lambda () (set! func (let a () a)) func))) [...] > - Is there a way to work around this (either using the abo

Re: Self-evaluating function and closure

2019-06-16 Thread Thomas Morley
Hi Mark, Am So., 16. Juni 2019 um 12:35 Uhr schrieb Mark H Weaver : > > Did I something wrong or is it a bug? > > Neither. This is a case of unspecified behavior, and the behavior of > our compiler differs from that of our interpreter. You will notice > similar discrepancies when comparing two

Re: Self-evaluating function and closure

2019-06-16 Thread Mark H Weaver
Hi Thomas, Thomas Morley writes: > always interested in guile developments with regard to lilypond I > noticed some inconsistence with my local lilypond-using-guile-2.9.2 > installation. > I think I could break it down to pure guile (no lilypond) > > (1) The already stated behaviour: > ~$ guile

Re: Self-evaluating function and closure

2019-06-16 Thread Mark H Weaver
Hi Vladimir, Vladimir Zhbanov writes: > On Sat, Jun 15, 2019 at 08:36:34PM -0400, Mark H Weaver wrote: >> Vladimir Zhbanov writes: >> >> > I have tried almost a textbook example with Guile 2.2.4: >> > >> > scheme@(guile-user)> (define (function-generator) >> >(let ((fun

Re: Self-evaluating function and closure

2019-06-16 Thread Thomas Morley
Am So., 16. Juni 2019 um 11:49 Uhr schrieb Mark H Weaver : > > Hello again Vladimir, > > Vladimir Zhbanov writes: > > - Is there a way to work around this (either using the above 'let' > > construct or anything else)? > > I'm not quite sure how to answer this question because I don't know what >

Re: Self-evaluating function and closure

2019-06-16 Thread Mark H Weaver
Hello again Vladimir, Vladimir Zhbanov writes: > - Is there a way to work around this (either using the above 'let' > construct or anything else)? I'm not quite sure how to answer this question because I don't know what your requirements are. If you need to generate unique tags, any mutable o

Re: Self-evaluating function and closure

2019-06-16 Thread Vladimir Zhbanov
Mark, On Sat, Jun 15, 2019 at 08:36:34PM -0400, Mark H Weaver wrote: > Hi Vladimir, > > Vladimir Zhbanov writes: > > > Greetings, > > > > I have tried almost a textbook example with Guile 2.2.4: > > > > scheme@(guile-user)> (define (function-generator) > >(let ((func #f)

Re: Self-evaluating function and closure

2019-06-15 Thread Mark H Weaver
Hi John, John Cowan writes: > On Sat, Jun 15, 2019 at 4:31 AM Vladimir Zhbanov wrote: > > The result is unexpected for me, I expected a new self-evaluating >> procedure every time I run the function-generator procedure (and >> it works differently with Guile 2.0, IIUC, cannot check just now). >

Re: Self-evaluating function and closure

2019-06-15 Thread Mark H Weaver
Hi Vladimir, Vladimir Zhbanov writes: > Greetings, > > I have tried almost a textbook example with Guile 2.2.4: > > scheme@(guile-user)> (define (function-generator) >(let ((func #f)) > (lambda () (set! func (let a () a))

Re: Self-evaluating function and closure

2019-06-15 Thread John Cowan
On Sat, Jun 15, 2019 at 4:31 AM Vladimir Zhbanov wrote: The result is unexpected for me, I expected a new self-evaluating > procedure every time I run the function-generator procedure (and > it works differently with Guile 2.0, IIUC, cannot check just now). > I tested this on Chicken, Biwa, and

Self-evaluating function and closure

2019-06-15 Thread Vladimir Zhbanov
Greetings, I have tried almost a textbook example with Guile 2.2.4: scheme@(guile-user)> (define (function-generator) (let ((func #f)) (lambda () (set! func (let a () a)) func))) scheme@(guile-user)> (define x (function-g