Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Multidimensional hyper
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Larry Wall  
View profile  
 More options Aug 20 2005, 12:29 am
Newsgroups: perl.perl6.language
From: la...@wall.org (Larry Wall)
Date: Fri, 19 Aug 2005 21:29:11 -0700
Local: Sat, Aug 20 2005 12:29 am
Subject: Re: Multidimensional hyper
On Sat, Aug 20, 2005 at 04:13:02AM +0000, Luke Palmer wrote:

: What is the resulting data structure in each of the following:
:
:     -<< [1, 2]

[-1, -2]

:     -<< [[1,2], [3,4]]

    [[-1,-2], [-3,-4]]

This is assuming that AoA is treated as a two dimensional shape, of course.
One could imagine pointers to things that might or might not have the
right role to function as a subdimension, but the bias of hypers is
towards processing the leaves, not forcing the top level to (in this
case) numerify.

:     -<< [[1,2], 3]

    [[-1,-2], -3]

Basically, unaries don't have to worry about reconciling different shapes.
They just recurse as much as is "reasonable", whatever that is.

:     [[1,2], 3] >>+<< [[4,5], 6]

    [[5,7], 9]

:     [1, 2, [3]] >>+<< [[4,5], 6]

Same as

    [1 >>+<< [4,5], 8, [3] >>+<< ()]

which gives

    [[5,6], 8, [3]]

I'd expect, maybe with a warning on 3 + undef, unless we default to
the identity value trait for + instead of undef.

Larry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Palmer  
View profile  
 More options Aug 20 2005, 12:13 am
Newsgroups: perl.perl6.language
From: lrpal...@gmail.com (Luke Palmer)
Date: Sat, 20 Aug 2005 04:13:02 +0000
Local: Sat, Aug 20 2005 12:13 am
Subject: Multidimensional hyper
What is the resulting data structure in each of the following:

    -<< [1, 2]
    -<< [[1,2], [3,4]]
    -<< [[1,2], 3]
    [[1,2], 3] >>+<< [[4,5], 6]
    [1, 2, [3]] >>+<< [[4,5], 6]

Luke


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yuval Kogman  
View profile  
 More options Aug 20 2005, 5:27 am
Newsgroups: perl.perl6.language
From: nothingm...@woobling.org (Yuval Kogman)
Date: Sat, 20 Aug 2005 12:27:23 +0300
Local: Sat, Aug 20 2005 5:27 am
Subject: Re: Multidimensional hyper

On Fri, Aug 19, 2005 at 21:29:11 -0700, Larry Wall wrote:
> Basically, unaries don't have to worry about reconciling different shapes.
> They just recurse as much as is "reasonable", whatever that is.

Possible exact semantics of "reasonable":

        hyper recurses at least one level, and then tries to match the
        type of the hyper'ed function on each element. If the type does
        not match, more attempts are made at recursion.

        If at any point the shapes of the current node is different from
        it's corresponding node in the other structure, then a binary
        function is applied regardless of type (resulting in coercion or
        a fatal error).

--
 ()  Yuval Kogman <nothingm...@woobling.org> 0xEBD27418  perl hacker &
 /\  kung foo master: /me does not drink tibetian laxative tea: neeyah!

  application_pgp-signature_part
< 1K Download

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Larry Wall  
View profile  
 More options Aug 20 2005, 11:36 am
Newsgroups: perl.perl6.language
From: la...@wall.org (Larry Wall)
Date: Sat, 20 Aug 2005 08:36:13 -0700
Local: Sat, Aug 20 2005 11:36 am
Subject: Re: Multidimensional hyper
On Sat, Aug 20, 2005 at 12:27:23PM +0300, Yuval Kogman wrote:

: On Fri, Aug 19, 2005 at 21:29:11 -0700, Larry Wall wrote:
:
: > Basically, unaries don't have to worry about reconciling different shapes.
: > They just recurse as much as is "reasonable", whatever that is.
:
: Possible exact semantics of "reasonable":
:
:       hyper recurses at least one level, and then tries to match the
:       type of the hyper'ed function on each element. If the type does
:       not match, more attempts are made at recursion.

Depends on what you mean by "match the type".  By one definition, an
array matches the type of +, so it should just hyper on the length of the
array, which is not what people are going to want generally.  I think you
have to try to recurse first.

:       If at any point the shapes of the current node is different from
:       it's corresponding node in the other structure, then a binary
:       function is applied regardless of type (resulting in coercion or
:       a fatal error).

That doesn't do dimension extension of scalars.  We want this to work

    1 >>+<< [1,2,3]

at any level in the hyper, but by the definition above it would add
1 to the length of [1,2,3].  Perhaps there's a Hyper role that says
whether a container can hyper, or defines a function that returns
some kind of hyper conformability type, so that scalars, arrays, and
hashes can be recognized, and maybe other types added.  I guess what
we're saying is that hyper does a mapping from named type to a general
structural type and then does MMD on the structural types.

Or maybe we just treat Item, Array, and Hash roles as structural
types, and let people add other MMDs if they want hyperdispatch to
other structural types.  Though this is getting dangerously close to
letting people change the parallel semantics of hyper for individual
named types, which is something I want to discourage, if not disallow
outright.  So I'm inclined to make named types pick one of the Big
Three to behave as before hyper ever sees them.

Though there could be a pecking order.  For instance, a match object
can do both the Array and Hash roles.  For hyper, it first tries to be
an Array, then a Hash.  If it's matched up against an Item or an Array,
it does Array.  If it's matched up against another Hash, it does Hash.

For now, I think we can just hardwire the analysis in terms of "does":

    given $obj {
        when Array { participate_as_array() }
        when Hash { participate_as_hash() }
        default { participate_as_item() }
    }

or maybe it's

    given $obj {
        when Ordered { participate_as_list() }
        when Hash { participate_as_hash() }
        default { participate_as_item() }
    }

to admit un-indexable lists.

Larry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google