Suppose I have:
base_array:   -1   -2 how could I do something like:
my_array: << base_array   -3 so that my_array was [1,2,3]
Update: I should specify that I want the extending to occur inside the YAML itself.
Since the already commented issue#35 exists, merge-keys << doesn't help you. It only merges/inserts referenced keys into a map (see YAML docs merge). Instead you should work with sequences and use anchor & and alias *.    
So your example should look like this:
base_list: &base     - 1     - 2  extended: &ext     - 3  extended_list:     [*base, *ext] Will give result in output like this (JSON):
{   "base_list": [     1,      2   ],    "extended": [     3   ],    "extended_list": [     [       1,        2     ],      [       3     ]   ] }  Although not exactly what you expected, but maybe your parsing/loading environment can flatten the nested array/list to a simple array/list.
You can always test YAML online, for example use:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With