[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Aldor-l] [Axiom-developer] spad: language and compiler
From: |
Ralf Hemmecke |
Subject: |
Re: [Aldor-l] [Axiom-developer] spad: language and compiler |
Date: |
Thu, 31 Aug 2006 12:16:54 +0200 |
User-agent: |
Thunderbird 1.5.0.5 (X11/20060719) |
Probably what we need is some kind of recursive type constructor.
See for example:
http://www.cs.kent.ac.uk/people/staff/sjt/Atypical/AldorExs/vector.as
If you look closer to that, then you see that vector.as is implementing
"List" in a terribly complicated way.
Look at
-- Add up the entries of a Vector(n).
addVec(n:Integer,v:Vector(n)):Integer
== {
import from Record(fst:Integer,rst:Vector(n-1));
if n<=1
then 0
else vec.fst + addVec(n-1,vec.rst);
where { vec == (v pretend -- A
Record(fst:Integer,rst:Vector(n-1))); }};
in particular look at the argument. If it were a list you could forget
about the n, but here you have to give it. I am sure, nobody would ever
use such code.
If you must have a union over Vectors of arbitrary lenght then a cleaner
design would be to define vectors of lenght n and in a second step
define operations on vectors of different length.
In aldor-combinat you would define that thing like in the BinaryTree
example I gave before but just use the equation V = 1 + X * V.
And, by the way, I did not use "pretend" in my code.
Ralf
- Re: [Axiom-developer] spad: language and compiler, (continued)
- Re: [Axiom-developer] spad: language and compiler, William Sit, 2006/08/30
- Re: [Axiom-developer] spad: language and compiler, Ralf Hemmecke, 2006/08/30
- Re: [Aldor-l] [Axiom-developer] spad: language and compiler, Jacques Carette, 2006/08/30
- Re: [Aldor-l] [Axiom-developer] spad: language and compiler, Gabriel Dos Reis, 2006/08/30
- Re: [Aldor-l] [Axiom-developer] spad: language and compiler, Jacques Carette, 2006/08/30
- Re: [Aldor-l] [Axiom-developer] spad: language and compiler, Gabriel Dos Reis, 2006/08/30
- Re: [Axiom-developer] spad: language and compiler, William Sit, 2006/08/30
- Re: [Axiom-developer] spad: language and compiler, Ralf Hemmecke, 2006/08/30
- RE: [Aldor-l] [Axiom-developer] spad: language and compiler, Page, Bill, 2006/08/30
- Re: [Aldor-l] [Axiom-developer] spad: language and compiler, Ralf Hemmecke, 2006/08/31
- Re: [Aldor-l] [Axiom-developer] spad: language and compiler,
Ralf Hemmecke <=
- RE: [Axiom-developer] Re: Axiom and commercial success, Bill Page, 2006/08/23
- [Axiom-developer] Re: Axiom and commercial success, root, 2006/08/24
- Re: [Axiom-developer] Re: Axiom and commercial success, Gabriel Dos Reis, 2006/08/24
- [Axiom-developer] Re: Axiom and commercial success, Gabriel Dos Reis, 2006/08/23
- Re: [Axiom-developer] SAGE, Axiom, and usage, C Y, 2006/08/22
- Re: [Axiom-developer] SAGE, Axiom, and usage, Gabriel Dos Reis, 2006/08/22
- Re: [Axiom-developer] SAGE, Axiom, and usage, C Y, 2006/08/22
- RE: [Axiom-developer] RE: Another question, Eitan Gurari, 2006/08/22
- Re: [Axiom-developer] RE: Another question, Ralf Hemmecke, 2006/08/22
- Re: [Axiom-developer] RE: Another question, Eitan Gurari, 2006/08/22