[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] Currying and iteration
From: |
Gabriel Dos Reis |
Subject: |
Re: [Axiom-developer] Currying and iteration |
Date: |
28 Mar 2006 07:36:08 +0200 |
"Page, Bill" <address@hidden> 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