[Aldor-l] LabelSpecies for L: LabelType -> CombinatorialSpecies L
Ralf Hemmecke
ralf at hemmecke.de
Mon Oct 23 04:12:04 EDT 2006
On 10/23/2006 09:47 AM, Martin Rubey wrote:
> Ralf Hemmecke <ralf at hemmecke.de> writes:
>
>> On 10/22/2006 07:54 PM, Martin Rubey wrote:
>>> Dear all,
>
>>> is there a way to check whether two constants are identical. I.e., I'd like
>>> to have
>>> foo(A: SomeCat, B: SomeCat): Boolean
>>> return true, if A and B are identical, false otherwise. In Axiom, we have
>>> "is" for that purpose, but it seems that "is" does not work in Aldor.
>> Right. "is" is only reserved but not defined.
>>
>> What about
>>
>> (A pretend Pointer) = (B pretend Pointer)
>>
>> ?
>>
>> Isn't that what "identical" means?
>
> Thanks, yes, that appears to work. At first, I also thought that this would be
> it, but I was discouraged by
>
> -------------------------------------------------------------------------------
> rubey at aquin:~$ aldor -gloop
> AA L DDDD OOO RRRR
> A A L D D O O R R
> A A L D D O O R R
> AAAAA L D D O O RRRR
> A A L D D O O R R
> A A LLLLL DDDD OOO R R
>
> (c) Numerical Algorithms Group Ltd 1995-2001
> Release: Aldor(C) version 1.0.3 for LINUX(glibc2.3)
> Type "#int help" for more details.
> %1 >> #include "aldor"
> Comp: 80 msec, Interp: 10 msec
> %2 >> #include "aldorinterp"
> Comp: 40 msec, Interp: 0 msec
> %3 >> import from MachineInteger, Pointer
> Comp: 10 msec, Interp: 0 msec
> %4 >> MachineInteger pretend Pointer
> 0x854b940 @ Pointer
> Comp: 0 msec, Interp: 100 msec
> %5 >> MachineInteger pretend Pointer
> 0x85879c0 @ Pointer
> Comp: 0 msec, Interp: 0 msec
> %6 >> MachineInteger pretend Pointer
> 0x8587d20 @ Pointer
> -------------------------------------------------------------------------------
>
> In compiled code, it works, though.
In fact, I was hesitating a bit before I sent out that Pointer stuff.
But you asked for "identical". I knew that there are instances where the
compiler creates different copies of the same domain. (You have shown it
above.) But then they are not "identical". You actually want to compare
equality of domains no matter where they are in memory. That seems to be
a bit difficult if the Aldor compiler doesn't store some magic number
with the domain.
Anyway, if you have a local variable x inside a domain A and there are
two copies of A in memory each with a different value for x. Are these
domains equal? Domain comparison seems impossible in general my eyes.
Ralf
More information about the Aldor-l
mailing list