lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme memory address


From: Gianmaria Lari
Subject: Re: scheme memory address
Date: Tue, 9 Apr 2019 17:19:42 +0200



On Tue, 9 Apr 2019 at 17:07, David Kastrup <address@hidden> wrote:
Gianmaria Lari <address@hidden> writes:

> On Tue, 9 Apr 2019 at 11:13, David Kastrup <address@hidden> wrote:
>
>> Gianmaria Lari <address@hidden> writes:
>>
>> > On Tue, 9 Apr 2019 at 10:45, David Kastrup <address@hidden> wrote:
>> >
>> >> Gianmaria Lari <address@hidden> writes:
>> >>
>> >> > Suppose I write
>> >> >
>> >> >
>> >> > #(define x '(1 2 3))
>> >> >
>> >> >
>> >> > is there any way in scheme to print the memory address where x is
>> >> pointing
>> >> > to? (where is allocated the first element of the list)
>> >>
>> >> What do you need it for?  If it is for identification, (hashq x
>> >> 1000000000) should usually do a reasonably good job.
>> >>
>> >
>> > I tried, it looks working. (Yes, it's for identification)
>> >
>> > And is there any way to print the memory address of x? (If I remember
>> > correctly was something like &x in c++).
>>
>> object-address maybe.  But it's not like you can use it for anything.
>
>
> If I didn't make any mistakes, this code print the "address" of the first
> element of the list x and the "address" of the first element pointed by the
> parameter "lst" of the "foo" function.

This is Scheme, not C.  1 would not have an address anyway since it is
an immediate value (self-represented).  And you are not printing the
address of the first element of the list but you are printing the
address of its cons cell.
[...]

Thank you David and Andrew for your extended reply and your suggestions!

g.



reply via email to

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