On Mon, Nov 9, 2009 at 10:54 PM, Waldek Hebisch wrote:
>
> Bill Page wrote:
>>
>> As you see above, there is not explicit pointer to an algebra object.
>>
>>         Rep := Record(value: S)
>>
>> is simply a "container" for things of type S.
>>
>>         ref v        == [v]
>>
>> returns this container as an object.
>>
>> > Unfortunately there is also the stupid coercion to single interger
>> > (hash) which is trivial. But one possibly could be to simply set the
>> > hash of any object to the pointer referencing it.
>>
>> Of course with the definition above this is not possible. *If* FriCAS
>> did provide a good hash value for things of type Record (it currently
>> does not), then what you suggest would be possible. In that case one
>> would return the hash for the container.
>>
>
> Actually, reasonable hash for Record is unreasonable for references:
> for Records use equality of components, for Reference we have:
>
>        p = q        == EQ(p, q)$Lisp
>
> which is quite different.

Yes you are right. I was wrong.(again) The hash function for Record
does not make sense here. (Although a hash function for Record does
make sense for it's own sake independent of this.)

> Actually, looking at the above I think that if we want to use
> Reference as pointers we really want:
>
>        p = q == EQ(p.value, q.value)$Lisp
>
> which still is different than Record equality (which would uses
> equality of values,

Values of type Reference are not necessarily pointers but they are
like memory addresses or variables that are not automatically
de-referenced. This is just like &x in the C language.

A pointer would be a "reference to a reference", i.e. something like this:

  q:=ref(3)$Reference(Integer)
  p:=ref(q)$Reference(Reference Integer)

> why we want identity (Lisp EQ) here.
>

If p and q were pointers (references to references) you would be
comparing their dereferenced values by EQ.

Regards,
Bill Page.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to fricas-devel@googlegroups.com
To unsubscribe from this group, send email to 
fricas-devel+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to