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

Aldor has generators:

http://www.aldor.org/docs/HTML/chap9.html
In fact, this form of using generators is so common, that if the expression E in for v in E. does not belong to a generator type, then an implicit call is made to an appropriate generator function. This is equivalent to writing for v in generator E.

The Aldor/Axiom interface provides such a generator for the Axiom Vector type. Let's try it.

More space? I am not sure why but it seems that I must increase GCL memory allocation to make this work.

fricas
)lisp (si::allocate-contiguous-pages 1500 t)
>> System error: Package SI does not exist.
Line: 1, Column: 30, File-Position: 30
Stream: #<SB-IMPL::STRING-INPUT-STREAM {100456CD13}>

aldor
#include "axiom"
myList(v:Vector Integer):List Integer == [ i for i in v ];
aldor
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/4218486668628728926-25px002.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.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/4218486668628728926-25px002.as", line 3: myList(v:Vector Integer):List Integer == [ i for i in v ]; .........^......^........^....^ [L3 C10] #9 (Error) There are no suitable meanings for the operator `Vector'. [L3 C17] #10 (Error) No meaning for identifier `Integer'. [L3 C26] #11 (Error) There are no suitable meanings for the operator `List'. [L3 C31] #12 (Error) No meaning for identifier `Integer'. [L3 C31] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

fricas
V:Vector Integer:=[1,2,3]

\label{eq1}\left[ 1, \: 2, \: 3 \right](1)
Type: Vector(Integer)
fricas
myList(V)
There are no library operations named myList Use HyperDoc Browse or issue )what op myList to learn if there is any operation containing " myList " in its name.
Cannot find a definition or applicable library operation named myList with argument type(s) Vector(Integer)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

Space left?

fricas
)lisp (room)
Dynamic space usage is: 81,550,560 bytes. Read-only space usage is: 5,952 bytes. Static space usage is: 4,000 bytes. Control stack usage is: 3,568 bytes. Binding stack usage is: 752 bytes. Control and binding stack usage is for the current thread only. Garbage collection is currently enabled.
Breakdown for dynamic space: 21,062,896 bytes for 21,705 code objects. 20,796,160 bytes for 1,299,760 cons objects. 12,684,720 bytes for 110,084 simple-vector objects. 10,734,688 bytes for 123,918 instance objects. 5,199,728 bytes for 57,833 simple-character-string objects. 11,072,368 bytes for 200,129 other objects. 81,550,560 bytes for 1,813,429 dynamic objects (space total.) Value = NIL

Re: aldor stream oddities --Bill Page, Thu, 09 Aug 2007 10:53:09 -0500 reply
On Aug 9, 2007 10:07 AM Franz Lehner wrote:

Hello,

is there a way to get hold of generate$Stream using the aldor compiler? I spent quite some time until figuring out that generate is probably a keyword in aldor (I could not check as the aldor site seems to be down) and this causes strange error messages. The following two snippets do not work, note that the second leads to a segfault:

  =================================================
  #include "axiom"

  teststream: with {
         zerostream:()->Stream Integer;
  } == add {
         zerostream():Stream Integer == {
                 import from Integer;
                 generate((x:Integer):Integer +-> 0@Integer,0@Integer);
  }
  }
  =================================================
  aldor -Fasy -Fao -Flsp  -laxiom -DAxiom -Y/home/lehner/usr/local/lib/wh-sandbox_s1/target/x86_64-unknown-linux/algebra test1.as "test1.as", line 8:
                   generate((x:Integer):Integer +-> 0@Integer,0@Integer);
  .........................^
  [L8 C26] #1 (Error) Have determined 1 possible types for the expression.
           Meaning 1: (x: Integer) -> Integer, Integer
     The context requires an expression of type Stream(Integer).

  make: *** [test.ao] Fehler 1

  =========================================================
  #include "axiom"

  teststream: with {
         zerostream:()->Stream Integer;
  } == add {
         zerostream():Stream Integer == {
                 import from Integer;
                 generate(():Integer +-> 0@Integer);
  }
  }
  =========================================================
  aldor -Fasy -Fao -Flsp  -laxiom -DAxiom -Y/home/lehner/usr/local/lib/wh-sandbox_s1/target/x86_64-unknown-linux/algebra est2.as
  Program fault (segmentation violation).#3 (Error) Program fault
  (segmentation violation).
  "test2.as", line 6:         zerostream():Stream Integer == {
                      .......................................^
  [L6 C40] #1 (Error) Have determined 0 possible types for the expression.
     Subexpression `import from Integer':
           Meaning 1: (0 types)

  "test.as", line 9:                 generate(():Integer +-> 0@Integer);
                      .........................^
  [L9 C26] #2 (Error) Have determined 0 possible types for the expression.

  make: *** [test.ao] Fehler 1

Bill Page replied:

Here is one way. The important thing is to escape the keyword generator by prefix with _.

aldor
#include "axiom"
teststream: with { zerostream:()->Stream Integer; } == add { zerostream():Stream Integer == { import from Integer; _generate((x:Integer):Integer +-> 0@Integer,0@Integer); } }
aldor
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/5904224867308724363-25px005.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.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/5904224867308724363-25px005.as", line 4: zerostream:()->Stream Integer; .....................^.^......^ [L4 C22] #11 (Error) There are no suitable meanings for the operator `->'. [L4 C24] #9 (Error) There are no suitable meanings for the operator `Stream'. [L4 C31] #10 (Error) No meaning for identifier `Integer'. [L4 C31] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

fricas
zerostream()
There are no library operations named zerostream Use HyperDoc Browse or issue )what op zerostream to learn if there is any operation containing " zerostream " in its name.
Cannot find a no-argument definition or library operation named zerostream .




  Subject:   Be Bold !!
  ( 13 subscribers )  
Please rate this page: