axiom-math
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-math] Re: [open-axiom-devel] [fricas-devel] Re: [fricas-devel] Re


From: Bill Page
Subject: [Axiom-math] Re: [open-axiom-devel] [fricas-devel] Re: [fricas-devel] Re: [fricas-devel] Re: iterators and cartesian product.
Date: Tue, 23 Oct 2007 21:07:01 -0400

On 10/23/07, Ralf Hemmecke wrote:
> >> Seems OK, but, of course the _domain_ 1..9 is then inappropriate in a
> >> construction like
> >>
> >>    for i in 1..9 repeat ...
> >>
> >> don't you agree?
> >>
> >
> > No. My proposal also includes the idea that the construct
> >
> >     for i in X repeat
> >
> > should expect X to be any domain that supplies a generator (like Aldor).
>
> In Aldor, at the place of X there must be an element of type
> "Generator(Something)", not a domain.

Can you give an example of an "element of type Generator(Something)"
that is not a domain?

> Well, if you have somewhere a function
>
>    generator: T -> Generator(Something)
>
> (where T is the type of X) around, then Aldor should be able to silently
> insert that function for you.
>

I said only "like Aldor". In my proposal for an extension of Spad and
the Axiom interpreter, I expect that X must supply this generator
(iterator), i.e. satisfy some specific language-defined category that
includes this export.

> I must say, I am totally happy with just *one* "for" construction.

That is exactly what I am suggesting. There should be no special cases
of the "for" construct - only one, where X is as I describe.

> I am currently not seeing much use in the domain 1..9, i.e. the finite set
> {1, ..., 9}.
>

The point of this whole thread is discussion of suggested constructions like

  [ f(i,j) for i in 1..9 repeat for j in 1..4 ]

i.e. some kind of "cross-product" extension of the for-loop iteration
such as the CROSS construction that Gaby described in Boot. Rather
than extending the language with this sort of imperative syntax, I
would like to write this in a more "functional" manner instead:

  [ f(x.1,x.2) for x in Product(1..9,1..4) ]

(Right now Product provides only 'selectfirst' and 'selectsecond'
instead of .1 and .2 but that is easily fixed.)

Or better

  map(f,expand()$Product(1..9,1..4))

which requires some slightly more general implementation of function
application over such domains.

Regards,
Bill Page.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]