axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] [AldorForAxiom] (nouveau)


From: kratt6
Subject: [Axiom-developer] [AldorForAxiom] (nouveau)
Date: Mon, 10 Jan 2005 05:56:28 -0600

It is possible to use the Aldor compiler to compile 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!

Let's do an example! Let's assume you have Aldor installed. You then have to do 
a little setup:

1. Grab the file 'axextend.lsp' from your axiom source distribution, it should 
reside in 'lsp/ccl/src/axbase/compiler/lib'. Rename it into 
'axextend.lsp.pamphlet' and run 'document axextend.lsp.pamphlet', to obtain the 
proper lisp code. 

2. Save the following into a file 'axiom.as' residing in 
'aldor/1.0.2/linux/include/' of your aldor (binary) distribution::

  -- Standard include file for using or extending Axiom library via AXIOM-XL

  #library AxiomLib "axiom"
  import from AxiomLib;
  inline from AxiomLib;

  macro {
          rep x == x @ % pretend Rep;
          per r == r @ Rep pretend %;
  }

  --import from Integer, PositiveInteger, NonNegativeInteger, SingleInteger;
  --import from Float, DoubleFloat;

  import { true: %, false: % } from Boolean;
  import {
          string:         Literal -> %;
  } from String;

3. Save the following example into a file fact.as::

  #include "axiom.as"
  
  fact(n: PositiveInteger): PositiveInteger == {
      n <= 1 => 1;
      res: PositiveInteger := 1;
      while n > 1 repeat {
          res := res * n;
          n := n-1;
      }
      res
   }

4. compile the example with::

  aldor -O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom fact.as

5. start Axiom

6. say -- replacing paths as appropriate::

  )lisp (load "aldor/linux/1.0.2/lib/runtime.lsp")
  )lisp (load 
"axiom--main--1--patch-24/lsp/ccl/src/axbase/compiler/lib/axextend.lsp")
  )lib fact

  fact(5)

Good luck. If you can get a domain to work, please contact 'address@hidden'!
--
forwarded from http://page.axiom-developer.org/zope/mathaction/address@hidden




reply via email to

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