Simon Cozens writes:
: I'm trying to answer the question "what does ^ mean?".
: Can anything be hyperoperated, or just a built-in set of operations?

Probably anything that is sufficiently "scalar" in its typology.

: If "anything", can user's subroutines be hyperoperated?

Why not?  (Provided the type signature isn't too wacky.)

: How will they know that they're being called in "hyper context"?

Do they need to?  In the simple case, the hyperoperator provides list
context to its arguments, but just calls the scalar operation repeatedly
to fake up the list operation.  Any operator

    @result = @a ^op @b

is really just something like

    @result = for @a; @b -> $a, $b { $a op $b }

(presuming we make C<for> actually act like C<map>).

For the case where one or the other argument is a scalar, we can just
replicate it to a list.

If the PDL folks want to get fancier, I'm sure we can arrange overloading
of ^op as easily as op.

Larry

Reply via email to