axiom-math
[Top][All Lists]
Advanced

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

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


From: Bill Page
Subject: [Axiom-math] Fwd: [open-axiom-devel] [fricas-devel] Re: [fricas-devel] Re: iterators and cartesian product.
Date: Wed, 31 Oct 2007 12:31:13 -0400

---------- Forwarded message ----------
From: Bill Page <address@hidden>
Date: Oct 31, 2007 10:54 AM
Subject: Re: [open-axiom-devel] [fricas-devel] Re: [fricas-devel] Re:
iterators and cartesian product.
To: Ralf Hemmecke <address@hidden>


On 10/30/07, Ralf Hemmecke wrote:
> Hi Bill,
>
> this goes offlist since I don't want to spam them...
>

Ok if you like, but I think other people on this list probably have
similar questions as you do so it would probably be of interest to
them too even though this thread is already quite long.

> On 10/22/2007 08:06 PM, Bill Page wrote:
> > On 10/22/07, Gabriel Dos Reis <address@hidden> wrote:
> >> On Mon, 22 Oct 2007, Bill Page wrote:
> >>
> >> | As I said, I want
> >> |
> >> |   Product(1..9,1..4)
> >> |
> >> | to be a domain - the cross-product of two other domains.
> >>
> >> I do not think
> >>
> >>     I want 1..9 to be a domain so that I can write
> >>     Product(1..9, 1..4) to be a cross product of two domains
> >>
> >> is an explanation of why `1..9' should be a domain.
> >
> > As I said earlier, I think the semantics of Product should be given
> > categorically by the existence of the unique operation
> >
> > Product(X:Type, Y:Type): with ...
> >
> >  product: (A:Type, A->X,A->Y) -> (A->%)
> >
> > as a categorical limit.
>
> As you know I like the categorical approach, but I don't understand,
> what a definition like your "product" has anything to do with how the
> "for" loop is traversed?
>
> You certainly know that a function
>
> product: (A:Type, A->X,A->Y) -> (A->%)
>
> is easily implemented (in Aldor, I don't know for spad).
> But I really don't see the connection to the "for".
>

The main issue has to do with programming style. The for-loop is a
construction from imperative-style programming. Operations like
'product' above operate directly on functions and return functions.
This is most common in a functional-programming style and might be
used for example in conjuction with another operation such as 'map' to
produce the same results a a for-loop constrcut:

map(product(Float,wholePart,sin),[1.1,2.2,3.3])

versus

[makeprod(wholePart x, sin x)$Product(Integer,Float) for x in [1.1,2.2,3.3]]

The functional-style has no dummy variables and no explicit for-loop.
In general one might view imperative-style programming as inherently
more "primitive" than functional programming so I think it should be
"allowed" because it is sometimes convenient but not encouraged. Aldor
and Spad usually provide both options. But the point with respect to
category theory is really that because the operation 'product' exists
and is uniquely defined (as a limit), it actual defines exactly what
is meant by the domain constructor Product, i.e. it provides the
semantics of Product. This has nothing directly to do with for-loops.

Regards,
Bill Page.




reply via email to

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