lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme memory address


From: David Kastrup
Subject: Re: scheme memory address
Date: Tue, 09 Apr 2019 22:40:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Carl Sorensen <address@hidden> writes:

> From: Gianmaria Lari <address@hidden>
> Date: Tuesday, April 9, 2019 at 8:17 AM
> To: David Kastrup <address@hidden>
> Cc: lilypond-user <address@hidden>
> Subject: Re: scheme memory address
>
> I wanted to print the address of the variable x and then the address
> of the parameter lst just to show that x and lst have different
> address (so x is passed by value. I could infer the same assigning to
> lst a new value and see that at the exit of the function x didn't get
> update). I hope I didn't say nothing wrong.
>
>
> Here's a stack overflow discussion about the various equal predicates
> in Scheme.  If you want to find out if two variables are the same
> object in memory, use eq? or eqv?, depending on the type of data the
> variables are (i.e., the data that the symbol is bound to).
>
> https://stackoverflow.com/questions/16299246/what-is-the-difference-between-eq-eqv-equal-and-in-scheme
>
> I think understanding it would help you.

If you want to find out if two variables are at the same place in memory
(if at all), just use eq? .  The problem is that its output is
unspecified when talking about numerical values exactly because there is
no guarantee that non-immediate numbers share or not share a memory
location even when their pedigree would suggest they are identical.  eq?
will tell you if they do which is neither dependable nor useful in
Scheme.

-- 
David Kastrup



reply via email to

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