

+------------+--------------+-------------+------------------+---------------+---------+---------+---------------------------------------------------------------------------+
|   Action   |     Dest     | Use Dest As |      Source      |Use Source As  | Offset  | Length  |                                  Result                                   |
|            |              |             |                  |               |         |         |                                                                           |
|            |              |             |                  |               |         |         |                                                                           |
+------------+--------------+-------------+------------------+---------------+---------+---------+---------------------------------------------------------------------------+
|    pop     |   arrayref   |   illegal   |     illegal      |   illegal     | illegal |         |splice( @$dest, -$length, $length )                                        |
+------------+--------------+-------------+------------------+---------------+---------+---------+---------------------------------------------------------------------------+
|   shift    |   arrayref   |   illegal   |     illegal      |   illegal     | illegal |         |splice( @$dest, 0, $length)                                                |
+------------+--------------+-------------+------------------+---------------+---------+---------+---------------------------------------------------------------------------+
|            |              |             |       any        |   element     |         |         |splice( @{parent(dest)}, $dest->attrs{idx} + $offset, $length, $source )   |
|            |              |             +------------------+---------------+---------+---------+---------------------------------------------------------------------------+
|            | array value  |   element   |     arrayref     |               |         |         |splice( @{parent(dest)}, $dest->attrs{idx} + $offset, $length, @$source )  |
|            |              |             +------------------+  container    +---------+---------+---------------------------------------------------------------------------+
|            |              |             |     hashref      |               |         |         |splice( @{parent(dest)}, $dest->attrs{idx} + $offset, $length, %$source )  |
|            +--------------+-------------+------------------+---------------+---------+---------+---------------------------------------------------------------------------+
| splice[1]  |              |             |       any        |   element     |         |         |splice( @$dest, $offset, $length, $source )                                |
|            |              |             +------------------+---------------+---------+---------+---------------------------------------------------------------------------+
|            |  array ref   |  container  |     arrayref     |               |         |         |splice( @$dest, $offset, $length, @$source )                               |
|            |              |             +------------------+  container    +---------+---------+---------------------------------------------------------------------------+
|            |              |             |     hashref      |               |         |         |splice( @$dest, $offset, $length, %$source )                               |
+------------+--------------+-------------+------------------+---------------+---------+---------+---------------------------------------------------------------------------+
|            |              |             |       any        |   element     |         |         |splice( @{parent(dest)}, $dest->attrs{idx} + $offset, 0, $source )         |
|            |              |             +------------------+---------------+---------+         +---------------------------------------------------------------------------+
|            | array value  |   element   |     arrayref     |               |         |         |splice( @{parent(dest)}, $dest->attrs{idx} + $offset, 0, @$source )        |
|            |              |             +------------------+  container    +---------+         +---------------------------------------------------------------------------+
|            |              |             |     hashref      |               |         |         |splice( @{parent(dest)}, $dest->attrs{idx} + $offset, 0, %$source )        |
|            +--------------+-------------+------------------+---------------+---------+         +---------------------------------------------------------------------------+
|            |              |             |       any        |   element     |         |         |splice( @$dest, $offset, 0, $source )                                      |
|   insert   |              |             +------------------+---------------+---------+ illegal +---------------------------------------------------------------------------+
|            |  array ref   |  container  |     arrayref     |               |         |         |splice( @$dest, $offset, 0, @$source )                                     |
|            |              |             +------------------+               +---------+         +---------------------------------------------------------------------------+
|            |              |             |     hashref      |               |         |         |splice( @$dest, $offset, 0, %$source )                                     |
|            +--------------+-------------+------------------+  container    +---------+         +---------------------------------------------------------------------------+
|            |              |             |     arrayref     |               |         |         |insert @$source into hash                                                  |
|            |   hashref    |  container  +------------------+               | illegal |         +---------------------------------------------------------------------------+
|            |              |             |     hashref      |               |         |         |insert %$source into hash                                                  |
+------------+--------------+-------------+------------------+---------------+---------+---------+---------------------------------------------------------------------------+
|            | array value  |             |                  |               |         |         |splice( @{parent(dest)}, $dest->attrs{idx} + $offset, $length )            |
|   delete   +--------------+   illegal   |     illegal      |   illegal     +---------+---------+---------------------------------------------------------------------------+
|            |  hash value  |             |                  |               | illegal | illegal |delete parent($dest)->{$dest->attrs{key}}                                  |
+------------+--------------+-------------+------------------+---------------+---------+---------+---------------------------------------------------------------------------+
|            |     any      |    value    |       any        |               | illegal | illegal |$dest = $source                                                            |
|            +--------------+-------------+------------------+               +---------+---------+---------------------------------------------------------------------------+
| replace[2] |              |             |      scalar      |   illegal     | illegal | illegal |parent($dest)->{$source} = parent($dest)->{$dest->attrs{key}}              |
|            |  hash value  |     key     +------------------+               +---------+---------+---------------------------------------------------------------------------+
|            |              |             |    reference     |               | illegal | illegal |parent($dest)->{refadder $source} = parent($dest)->{$dest->atrs{key}}      |
+------------+--------------+-------------+------------------+---------------+---------+---------+---------------------------------------------------------------------------+


Source Cardinality
------------------

given ( $cardinality ) {


      when ( 1 ) { }
      when ( $_ > 1 ) {


        given( $source_cardinality_mode ) {


	  when( iterate ) {

	     iterate over returned search values

          }

          when( array ) {

	     $source = [ map { $_->value  } returned search context ];

          }



          when( hash ) {

	   $source = { map { defined $_->attr->{key} ? ( $key =>  $_->value  ) : $idx => $_->value } returned search contexts 

	  }

	  default {

	  error.
	  

	  }
	}	


      }

}

Notes
-----

[1] splice action requires at least one of Offset and Length to be specified.

[2] replace uses 'replace' instead of 'use_dest_as'

Defaults
--------

* use_source_as = ref $source ? 'container' : 'value'

splice
======
  use_dest_as = is_arrayref( $dest ) ? 'container' : defined $idx ? 'element' : croak;

insert
======
  use_dest_as = is_arrayref( $dest ) | is_hashref( $dest ) ? 'container' : defined $idx ? 'element' : croak;


- pop
  - { length: 1 }
- shift
  - { length: 1 }
-splice
  - offset : 0
  - length : undef
-insert
  - offset = 0
-replace
  - target = 'value'