"Page, Bill" <[EMAIL PROTECTED]> writes:

| On Monday, March 27, 2006 9:57 PM Gaby wrote:
| > ...
| > | 
| > | 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.
| > 
| > That should be seen as a "defect".  for...in should be made to
| > work with sequence (whether built-in list or vectors).
| > 
| 
| What is a "sequence"?

Sequence is my general term for list, vector or any "thingy" walked
through by a generator.

| As far as I know this is not defined in Axiom.

yes, I know.  That is precisely why I said it "should be" seen as a
defect. 

| Do mean that some types should be automatically coercible
| to type List? 

No.  I'm saying that the "iterator constructor" should be made to
traverse vectors too, not just list; and no I don't consider
convolutions like "entries V" acceptable :-).

| Note that:
| 
|   V:=vector [1,2,3]
|   [i for i in V::List Integer]
| 
| works in the Axiom interpreter but it is not clear to me exactly
| where this conversion is defined.

coercion to List should not be needed, nor required.  Hey, have a look
at what you have around in Java, C#, Perl, etc. (admittely, Perl is
convoluted). 

-- Gaby


_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to