[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] Unions in Spad
From: |
Ralf Hemmecke |
Subject: |
Re: [Axiom-developer] Unions in Spad |
Date: |
Fri, 13 Jul 2007 21:10:33 +0200 |
User-agent: |
Thunderbird 2.0.0.4 (X11/20070604) |
>> So you can see from your example that i1 and i2 give, respectively,
>> (0 . 1) and (0 . 2), thus inj1 and inj2 are placing their values
>> in the tag1 field.
>
> This simple representation limits the generality and naturalness of
> implementation. But where are the tags?
Compile the following program with
aldor -flsp -fc -laldor aaa.as
and grep generated the lisp and c sources for "tag1".
You will not find it.
Why do you think that limits the generality of the implementation. Why
do you think "tag1" is important in generated code?
If you create something of the form Union(foo:Integer,bar:Integer) you
get exactly the same representation in the generated file, but still as
aldor code you cannot turn an element of
Union(foo:Integer,bar:Integer)
into
Union(tag1:Integer,tag2:Integer)
since these are two different types.
Ralf
-----------------
#pile
#include "aldor"
#include "aldorio"
Bar : Exp == Impl where
Exp ==> with
inj1 : Integer -> %
prj1 : % -> Integer
Impl ==> add
Rep == Union(tag1: Integer, tag2: Integer)
import from Rep
inj1(n : Integer) : % == per [tag1==n]
prj1(p: %): Integer == (rep p).tag1
main(): () == {
z: Integer := 1;
b1: Bar := inj1 z;
stdout << "prj1 b1 = " << prj1 b1 << newline;
}
main();
-------------------
- Re: [Axiom-developer] Unions in Spad, (continued)
- Re: [Axiom-developer] Unions in Spad, William Sit, 2007/07/13
- Re: [Axiom-developer] Unions in Spad, William Sit, 2007/07/13
- Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/13
- Re: [Axiom-developer] Unions in Spad, Stephen Wilson, 2007/07/13
- Re: [Axiom-developer] Unions in Spad, William Sit, 2007/07/15
- Re: [Axiom-developer] Unions in Spad, Stephen Wilson, 2007/07/15
- Re: [Axiom-developer] Unions in Spad (Correction), William Sit, 2007/07/13
- Re: [Axiom-developer] Unions in Spad (Correction), Stephen Wilson, 2007/07/13
- [Axiom-developer] Re: keyword arguments, was: Unions in Spad (Correction), Martin Rubey, 2007/07/14
- Re: [Axiom-developer] Re: keyword arguments, was: Unions in Spad (Correction), Bill Page, 2007/07/21
- Re: [Axiom-developer] Unions in Spad,
Ralf Hemmecke <=
- Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/13
- Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/13
- Re: [Axiom-developer] Unions in Spad, Stephen Wilson, 2007/07/13
- Re: [Axiom-developer] Unions in Spad, Stephen Wilson, 2007/07/13
- Re: [Axiom-developer] Unions in Spad, Gabriel Dos Reis, 2007/07/13
- rep, per, Rep in SPAD/Aldor, was: Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/13
- Re: rep, per, Rep in SPAD/Aldor, was: Re: [Axiom-developer] Unions in Spad, Gabriel Dos Reis, 2007/07/13
- [Axiom-developer] Re: rep, per, Rep in SPAD/Aldor, Ralf Hemmecke, 2007/07/13
- [Axiom-developer] Re: rep, per, Rep in SPAD/Aldor, Gabriel Dos Reis, 2007/07/14
- [Axiom-developer] Re: rep, per, Rep in SPAD/Aldor, Ralf Hemmecke, 2007/07/14