[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] [#209 The function |Domain| is undefined] correct bug
From: |
Bill Page |
Subject: |
[Axiom-developer] [#209 The function |Domain| is undefined] correct bug in coercion to OutputForm |
Date: |
Thu, 29 Sep 2005 23:18:02 -0500 |
Changes http://wiki.axiom-developer.org/209TheFunctionDomainIsUndefined/diff
--
++added:
This fails
??changed:
-
-This domain (based on AldorDomain) written in Aldor by Peter
-Broadbery::
-
- ... can still do some useful things with them by disguising the fact
- that they are domains, so in aldor have a type
-
- AldorDomain: with {
- make: (T: BasicType) -> %
- } == add {
- Rep ==> T;
-
- make(T: BasicType): % == per T;
- }
-
- and your aldor programs can return this to axiom.
-
- Then make sure the interpreter can only see it.
-
-[17 more lines...]
\begin{axiom}
Tuple Type
\end{axiom}
But this works
\begin{axiom}
List Type
\end{axiom}
The following domain called 'Domain' provides some of the
missing functionality. It is based on 'AldorDomain' by Peter
Broadbery who writes::
![One] can still do some useful things with them by disguising
the fact that they are domains, so in aldor have a type and
your aldor programs can return this to axiom.
For example:
\begin{aldor}
#include "axiom.as"
AldorDomain(T:Type): with {
make: () -> %;
coerce: (%) -> OutputForm;
} == add {
Rep ==> Type;
make(): % == per T;
coerce(t: %): OutputForm == {
import from SExpression;
devaluate(t pretend SExpression)::OutputForm
};
import {
BOOT_:_:devaluate: SExpression -> SExpression;
} from Foreign Lisp;
local devaluate(s: SExpression): SExpression == {
BOOT_:_:devaluate(s);
}
}
\end{aldor}
\begin{axiom}
aInteger:=make()$AldorDomain(Integer)
\end{axiom}
--removed:
-
-provides some of the missing functionality.
??changed:
-Domain: SetCategory with {
- make: (T: BasicType) -> %;
-
- theIntegerType: () -> %;
- map: (%, %) -> %;
- integerMod: PositiveInteger -> %;
-
- coerce: % -> OutputForm;
-
- name: % -> SExpression;
-
- lookup: (%, String, %) -> SExpression;
-
- hashCode: % -> Integer;
-
-} == add {
Domain: SetCategory == add {
(a: %) = (b: %): Boolean == {
import from SExpression;
a pretend SExpression = b pretend SExpression
}
coerce(t: %): OutputForm == {
import from SExpression;
devaluate(t pretend SExpression)::OutputForm
};
--removed:
- BOOT_:_:hashString: SExpression -> SExpression;
--removed:
-
- Rep ==> Type;
- Rep2 ==> Record(v: Record(domType: SExpression -> SExpression,
- domName: SExpression -> SExpression,
- notUsed: SExpression -> SExpression,
- lookup: (SExpression, SExpression,
SExpression,
- SExpression, SExpression,
SExpression,
- SExpression) -> SExpression,
- hashCode: SExpression -> SExpression,
- unknown: SExpression -> SExpression),
- o: SExpression);
-
- import from Rep2;
-
- make(T: BasicType): % == per T;
- theIntegerType(): % == per Integer;
- integerMod(p: PositiveInteger): % == per(IntegerMod p);
-
- map(arg: %, ret: %): % == {
-[40 more lines...]
--removed:
-
- local hashString(s: SExpression): SExpression == {
- BOOT_:_:hashString(s);
- }
??changed:
-(Integer,Float)
a:=(Integer,Float)
++added:
Except::
!\begin{axiom}
select(a,1)
\end{axiom}
causes Axiom to abort.
--
forwarded from http://wiki.axiom-developer.org/address@hidden