[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## RE: [Axiom-developer] Currying and iteration

**From**: |
Page, Bill |

**Subject**: |
RE: [Axiom-developer] Currying and iteration |

**Date**: |
Mon, 27 Mar 2006 21:21:51 -0500 |

On Monday, March 27, 2006 7:06 PM Antoine Hersen wrote:
>* *
>* 2 questions :*
>* *
>* On currying, is this a defect or it is normal ?*
>* *
>* (31) -> i j +-> i + j*
>* *
>* (31) i +-> j +-> i + j*
>* Type: AnonymousFunction*
>* (32) -> %(1)*
>* *
>* (32) j +-> G93074 + j*
>* Type: AnonymousFunction*
>* (33) -> %(1)*
>* *
>* (33) G93074 + 1*
>* Type: Polynomial Integer*
I would say obviously it is a defect. (What is 'G93074'?) As
far as I know,
i j +-> i + j
is not syntactically well-formed even though the interpreter
makes no complaint. Further:
i +-> (j +-> i + j)
is well-formed but it gives the same error as above.
I think you should report this as an error at:
http://wiki.axiom-developer.org/IssueTracker
This works however if the function is not anonymous:
)set function compile on
P:INT->(INT->INT)
P(i) == j +-> i + j
(P 1) 1
>* *
>* On iteration*
>* *
>* You can use the map operation on Vector and List but you can*
>* iterate( [ i for i in List] ).*
>* Is iteration built in a lower level of than spad, if not what*
>* should I do to make Vector iteratable or is it not desirable ?*
>* *
As discussed in section "5.4.8 for Loops" of the Axiom book, you
may follow the keyword 'in' only by an integer segment, stream or
a list, but try this:
V:=vector [1,2,3]
[i for i in entries V]
The function 'entries' returns the elements of a vector as a
List.
Regards,
Bill Page.