|
|
last edited 1 year ago by test1 |
1 2 3 4 5 6 7 8 9 | ||
Editor: Bill Page
Time: 2007/09/19 08:25:03 GMT-7 |
||
Note: |
changed: -- WebSite:www.aldor.org/docs/HTML/chap1.html - http://www.aldor.org/docs/HTML/chap1.html
From section 1.2 of Aldor Users Guide
aldor# include "axiom.as" import from Boolean, Integer, NonNegativeInteger; sieve(n: Integer): Integer == { isprime: OneDimensionalArray Boolean := new(n::NonNegativeInteger, true); np:Integer := 0; for p in 2..n | isprime p repeat { np := np + 1; for i in (p+p)..n by p repeat isprime i := false; } np }
Compiling AXIOM source code from file /var/zope/var/LatexWiki/7854205204878194253-25px001.as using AXIOM-XL compiler and options -O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom -Y $AXIOM/algebra Use the system command )set compiler args to change these options. The )library system command was not called after compilation.
axiom)lisp (si::allocate-contiguous-pages 1500 t) Value = T )lisp (si::allocate 'sfun 50 t) Value = T for i in 1..4 repeat n := 10^i outputList ["There are ", sieve n, " primes <= ", n] There are no library operations named sieve Use HyperDoc Browse or issue )what op sieve to learn if there is any operation containing " sieve " in its name. Cannot find a definition or applicable library operation named sieve with argument type(s) PositiveInteger Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. AXIOM will attempt to step through and interpret the code. There are no library operations named sieve Use HyperDoc Browse or issue )what op sieve to learn if there is any operation containing " sieve " in its name. Cannot find a definition or applicable library operation named sieve with argument type(s) PositiveInteger Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.
To run this program on your own computer you need linux and Axiom+Aldor from AxiomBinaries?.
$ vi sieve.as
$ AXIOMsys
(1) -> )compile sieve.as
for i in 1..6 repeat ( _ n := 10^i; _ outputList ["There are ", sieve n, " primes <= ", n] _ )
aldor#include "axiom.as" macro Z == Integer; main(): Boolean == { import from Z; b: Boolean := prime? 4; return b; }
Compiling AXIOM source code from file /var/zope/var/LatexWiki/6811962111969699119-25px003.as using AXIOM-XL compiler and options -O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom -Y $AXIOM/algebra Use the system command )set compiler args to change these options. The )library system command was not called after compilation.
axiommain() There are no library operations named main Use HyperDoc Browse or issue )what op main to learn if there is any operation containing " main " in its name. Cannot find a no-argument definition or library operation named main .