On 10/23/07, Ralf Hemmecke wrote:
> > [ f(x.1,x.2) for x in Product(1..9,1..4) ]
>
> Take my implementation from
>
> http://lists.gnu.org/archive/html/axiom-math/2007-10/msg00023.html
>
> then I don't see a reason (in Aldor) why it shouldn't even be possible
> to say
>
> [f x for x in (1..9)*(1..4)]
>
> where f: (Integer, Integer) -> Something.
>
Yes, this would be (almost) possible now in Axiom/Spad if we allow the
'* to be an export of Segment and the signature of '*' to be:
* : (%,%) - > List DirectProduct(2,S)
Let's also provide
*:(List DirectProduct(2,S),%) -> List DirectProduct(3,S)
etc. I think the implementation is fairly obvious.
Not such a bad idea!
In the Axiom interpreter (but not in Spad?) we can also write a Stream
as an iterator, e.g.
(1) -> x:=repeating [1,2,3]
_____
(1) [1,2,3]
Type: Stream PositiveInteger
(2) -> [i for i in x]
(2) [1,2,3,1,2,3,1,2,3,1,...]
Type: Stream PositiveInteger
So it would be possible to replace List DirectProduct ... with Stream
DirectProduct.
But as I said earlier in this thread, this sort of construction is not
as general as I would hope for. How would I write for example?
[i for i in Product(OVAR [a,b,c], 1..3)]
[ (a,1), (a,2), (a,3), (b,1), ... ]
Regards,
Bill Page.
_______________________________________________
Axiom-math mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-math