axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] [AldorForAxiom]


From: kratt6
Subject: [Axiom-developer] [AldorForAxiom]
Date: Tue, 11 Jan 2005 09:01:25 -0600

??changed:
-functions which you then can use in Axiom. Unfortunately, I could not get
-domains and packages to work. If anybody knows how to do this, please
-contribute!
functions which you then can use in Axiom. Unfortunately, support for domains
and packages is still buggy, but it's nearly working - thanks to Peter!

??changed:
-6. say -- replacing paths as appropriate::
6. say - replacing paths as appropriate::

??changed:
-If you can get a domain to work, please contact 'address@hidden'!
-Having put into a file 'test.as' the following minimal package::
Getting domains to work is a little more of an effort currently, since you have
to patch Axiom a little. Modify the files in 'src/interp' of your axiom
(source-) distribution as follows - the patches are due to Peter Broadbery::

  Index: as.boot.pamphlet
  ===================================================================
  RCS file: /cvsroot/axiom/axiom/src/interp/as.boot.pamphlet,v
  retrieving revision 1.3
  diff -u -r1.3 as.boot.pamphlet
  --- as.boot.pamphlet  24 May 2004 22:53:49 -0000      1.3
  +++ as.boot.pamphlet  8 Jan 2005 19:01:23 -0000
  @@ -389,7 +389,8 @@
       HPUT(ht,id,[entry,:HGET(ht,id)])
     opalist := [[op,:REMDUP HGET(ht,op)] for op in HKEYS ht]
     --HPUT($opHash,con,[ancestorAlist,attributeAlist,:opalist])
  -  HPUT($opHash,con,[ancestorAlist,attributeAlist,:opalist])
  +  --HPUT($opHash,con,[ancestorAlist,attributeAlist,:opalist])
  +  HPUT($opHash,con,[ancestorAlist,nil,:opalist])
   
   hackToRemoveAnd p ==
   ---remove this as soon as .asy files do not contain forms (And pred) forms
  Index: ax.boot.pamphlet
  ===================================================================
  RCS file: /cvsroot/axiom/axiom/src/interp/ax.boot.pamphlet,v
  retrieving revision 1.3
  diff -u -r1.3 ax.boot.pamphlet
  --- ax.boot.pamphlet  24 May 2004 22:53:49 -0000      1.3
  +++ ax.boot.pamphlet  8 Jan 2005 19:01:26 -0000
  @@ -80,11 +80,29 @@
        axForms :=
           [['Foreign, ['Declare, 'dummyDefault, 'Exit], 'Lisp], :axForms]
     axForms := APPEND(axDoLiterals(), axForms)
  -  axForm := ['Sequence, ['Import, [], 'AxiomLib], :axForms]
  +  axForm := ['Sequence, ['Import, [], 'AxiomLib], ['Import, [], 'Boolean], 
:axForms]
     st := MAKE_-OUTSTREAM(filename)
     PPRINT(axForm,st)
     CLOSE st
   
  +makeAxExportForm(filename, constructors) ==
  +  $defaultFlag : local := false
  +  $literals := []
  +  axForms :=
  +     [modemapToAx(modemap) for cname in constructors |
  +            (modemap:=GETDATABASE(cname,'CONSTRUCTORMODEMAP)) and
  +              (not cname in '(Tuple Exit Type)) and
  +                not isDefaultPackageName cname]
  +  if $baseForms then
  +     axForms := [:$baseForms, :axForms]
  +  if $defaultFlag then
  +     axForms :=
  +        [['Foreign, ['Declare, 'dummyDefault, 'Exit], 'Lisp], :axForms]
  +  axForms := APPEND(axDoLiterals(), axForms)
  +  axForm := ['Sequence, ['Import, [], 'AxiomLib], ['Import, [], 'Boolean], 
:axForms]
  +  axForm
  +
  +
   stripType type ==
     $stripTypes =>
        categoryForm? type => 'Type
  Index: i-syscmd.boot.pamphlet
  ===================================================================
  RCS file: /cvsroot/axiom/axiom/src/interp/i-syscmd.boot.pamphlet,v
  retrieving revision 1.4
  diff -u -r1.4 i-syscmd.boot.pamphlet
  --- i-syscmd.boot.pamphlet    28 Dec 2004 07:42:45 -0000      1.4
  +++ i-syscmd.boot.pamphlet    8 Jan 2005 19:01:36 -0000
  @@ -642,7 +642,7 @@
       if ^beQuiet then sayKeyedMsg("S2IZ0038A",[namestring args, asharpArgs])
   
       command :=
  -     STRCONC(TRUENAME(STRCONC(GETENV('"AXIOM"),'"/compiler/bin/")),"axiomxl 
", asharpArgs, '" ", namestring args)
  +     STRCONC(STRCONC(GETENV('"AXIOM"),'"/compiler/bin/"),"axiomxl ", 
asharpArgs, '" ", namestring args)
       rc := OBEY command
   
       if (rc = 0) and doCompileLisp then
  
Then, having put the following simple domain in a file 'test.as' ::

??changed:
-I compiled it with Aldor as above. But sadly, in axiom I get::
I compiled it with Aldor as above. In axiom you should get::

??changed:
-   Reading /home/rubey/martin/Axiom/test.asy
-   Loading /home/rubey/axiom/mnt/linux/autoload/bc-matrix.
-   Loading /home/rubey/axiom/mnt/linux/autoload/bc-misc.
-   Loading /home/rubey/axiom/mnt/linux/autoload/bc-solve.
-   Loading /home/rubey/axiom/mnt/linux/autoload/bc-util.
-   Loading /home/rubey/axiom/mnt/linux/autoload/ht-util.
-   Loading /home/rubey/axiom/mnt/linux/autoload/htsetvar.
-   Loading /home/rubey/axiom/mnt/linux/autoload/ht-root.
-   Loading /home/rubey/axiom/mnt/linux/autoload/br-con.
-   Loading /home/rubey/axiom/mnt/linux/autoload/br-data.
-   Loading /home/rubey/axiom/mnt/linux/autoload/showimp.
-   Loading /home/rubey/axiom/mnt/linux/autoload/br-op1.
-   Loading /home/rubey/axiom/mnt/linux/autoload/br-op2.
-   Loading /home/rubey/axiom/mnt/linux/autoload/br-search.
-   Loading /home/rubey/axiom/mnt/linux/autoload/br-util.
-   Loading /home/rubey/axiom/mnt/linux/autoload/topics.
-   Loading /home/rubey/axiom/mnt/linux/autoload/br-prof.
-   Loading /home/rubey/axiom/mnt/linux/autoload/br-saturn.
- 
-[4 more lines...]
  (1) -> )sh Test
    Test  is a domain constructor
    Abbreviation for Test is TEST 
    This constructor is exposed in this frame.
    Issue )edit test.as to see algebra source code for TEST 
   
   ------------------------------- Operations --------------------------------
    fact : PositiveInteger -> PositiveInteger
   
   (1) -> fact(5)$Test
   
      (1)  120
                                                           Type: PositiveInteger
   (2) -> fact(4)$Test
    
      >> System error:
      #<vector 08cf4150> is not of type LIST.
   
As you can see, starting with the second application of a function in the
domain, Axiom fails. Maybe you can fix this?

Peter also pointed out that

 - aldor "extend" does not work - it ought to, I think

 - The algebra defined in libaxiom.al is not current, and for it to be rebuilt
   various .as files need to be available to the build process (axextend.as and
   friends) - any reason why they're left out of the distribution?

 - exported attributes from aldor domains are explicitly killed off by this
   patch (it's probably easy to fix, just no time atm).  

 - Only tested the most trivial domains I could find.

Indeed, the following Aldor construct does not yet work in Axiom::

  #include "axiom"
  
  Test: with { f: (n: PositiveInteger) -> PrimeField(n) } 
     == add { f(n: PositiveInteger): PrimeField(n) == 
                10::Integer::PrimeField(n) }

It nearly works, as one can see from a trace done with 
')lisp (setq |$monitorNewWorld| t)', but not quite...

--
forwarded from http://page.axiom-developer.org/zope/mathaction/address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]