login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #209 The function |Domain| is undefined revision 1 of 2

1 2
Editor:
Time: 2007/11/17 22:08:52 GMT-8
Note: correct bug in coercion to OutputForm

changed:
-
This fails
\begin{axiom}
(Integer,Float)
\end{axiom}
\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}

Ref:

  http://lists.nongnu.org/archive/html/axiom-developer/2005-09/msg00250.html

  http://lists.nongnu.org/archive/html/axiom-developer/2005-09/msg00248.html

\begin{aldor}[domain]
#include "axiom.as"

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
        };

        import {
                BOOT_:_:devaluate: SExpression -> SExpression;
        } from Foreign Lisp;

        local devaluate(s: SExpression): SExpression == {
                BOOT_:_:devaluate(s);
        }
}
\end{aldor}

And it nearly solves the problem!
\begin{axiom}
a:=(Integer,Float)
\end{axiom}

Except::

  !\begin{axiom}
  select(a,1)
  \end{axiom}

causes Axiom to abort.

Submitted by : (unknown) at: 2007-11-17T22:08:52-08:00 (17 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

This fails

axiom
(Integer,Float)
LISP output: (UNPRINTABLE UNPRINTABLE)
Type: Tuple(Type)

axiom
Tuple Type
LISP output: (UNPRINTABLE)
Type: Tuple(Category)

But this works

axiom
List Type

\label{eq1}\hbox{\axiomType{List}\ } (\hbox{\axiomType{Type}\ })(1)
Type: Type

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:

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); } }
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/5624154441249846913-25px004.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./5624154441249846913-25px004.lsp
   Issuing )library command for 5624154441249846913-25px004
   Reading /var/zope2/var/LatexWiki/5624154441249846913-25px004.asy
   AldorDomain is now explicitly exposed in frame initial 
   AldorDomain will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/5624154441249846913-25px004
>> System error: The bounding indices 163 and 162 are bad for a sequence of length 162. See also: The ANSI Standard, Glossary entry for "bounding index designator" The ANSI Standard, writeup for Issue SUBSEQ-OUT-OF-BOUNDS:IS-AN-ERROR

axiom
aInteger:=make()$AldorDomain(Integer)

\label{eq2}\left(\hbox{\axiomType{Integer}\ } \right)(2)
Type: AldorDomain?(Integer)

Ref:

http://lists.nongnu.org/archive/html/axiom-developer/2005-09/msg00250.html

http://lists.nongnu.org/archive/html/axiom-developer/2005-09/msg00248.html

aldor
#include "axiom.as"
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 };
import { BOOT_:_:devaluate: SExpression -> SExpression; } from Foreign Lisp;
local devaluate(s: SExpression): SExpression == { BOOT_:_:devaluate(s); } }
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/domain.as using AXIOM-XL compiler and 
      options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file ./domain.lsp
   Issuing )library command for domain
   Reading /var/zope2/var/LatexWiki/domain.asy
   Domain is now explicitly exposed in frame initial 
   Domain will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/domain
>> System error: The bounding indices 163 and 162 are bad for a sequence of length 162. See also: The ANSI Standard, Glossary entry for "bounding index designator" The ANSI Standard, writeup for Issue SUBSEQ-OUT-OF-BOUNDS:IS-AN-ERROR

And it nearly solves the problem!

axiom
a:=(Integer,Float)
LISP output: (UNPRINTABLE UNPRINTABLE)
Type: Tuple(Type)

Except:

  \begin{axiom}
  select(a,1)
  \end{axiom}

causes Axiom to abort.