On Sun, Oct 08, 2006 at 04:07:37PM +0200, Juerd wrote:
: S03 says that hypers recurse into subarrays.
:
: That's a nice and useful feature, but that not-recursing is even more
: useful. Especially given that many objects will probably does Array, you
: want to be explicit about recursion.
:
: S03 doesn't give a way to avoid recursion.
Recursion is not really the issue here. Conformancy is, I think.
: I suggested on #perl6 that standard hypers do not recurse, and a new
: operator: double hypers. These are the same, but they do recurse. From
: my point of view, hypers should operate on lists, not arrays. Recursive
: hypers would work on arrays because arrays are single element lists.
See the latest S03 changes. Standard hypers now require conformancy,
and I introduced small-ended hypers (whimpers?) to ask for dwimmery.
: Audrey agreed.
Audrey is very agreeable. :)
: It would probably be useful to allow combinations of recursive and
: non-recursive hypers.
:
: »+« # do not dive into arrays
: »»+«« # do dive into arrays, on both sides
: »+«« # dive into arrays only on the RHS
: »»+« # same, but LHS
:
: 42, 15 »+ 1 # 43, 16
:
: ( 42, 15 ) »+ 1 # 43, 16
:
: [ 42, 15 ] »+ 1 # 2
:
: [ 42, 15 ] »»+ 1 # [ 43, 16 ]
:
: The ASCII variant is a bit big, but that's okay huffmanwise, IMO.
: Recursion can be a pretty big operation anyway. Being explicit about
: that is good.
I think the current S03 solution is a lot prettier, and keeps most of
the symmetry of the old hyper solution, while visually indicating the
"smaller" argument:
@foo »+» 1
For the old symmetrically dwimmy infix hyper behavior you just write:
@foo «+» @bar
Larry