Help language development. Donate to The Perl Foundation

List::Operator::DoublePlus zef:tqdv last updated on 2022-02-23
_Generated from DoublePlus.rakumod, then manually edited._




    use List::Operator::DoublePlus;
    # Concatenate two lists together
    my @l  = @l1 ++ @l2;
    my @l' = @l1 ⧺ @l2;
    # The operator also works with Arrays and Slips


Provides a `++` operator to join or concatenate two lists together. The operator `⧺` is also exported as its Unicode counterpart.

The `concat` subroutine that implements the operator's functionality is exported on demand using the `sub` tag.

This module is inspired by Aaron Sherman's `Operator::Listcat` which defines an infix `listcat` operator, as well as the infix `⊕` (CIRCLED PLUS) Unicode alias.



The operator form of `&concat`.


The Unicode operator variant of `++`.


multi sub concat(@a, @b --> List) multi sub concat(Slip \a, Slip \b --> Slip) multi sub concat(Array \a, Array \b --> Array)

Calls `.Slip` (which calls `.list`) on both arguments and applies the infix `,` operator to join them into a list.

For Slips, it returns a new Slip instead of a List.

For Arrays, it calls `.append` on the first parameter with the second parameter as its argument, and returns the combined array.

This subroutine also works for Seqs and any class that does PositionalBindFailover.



Same as :op, it exports the ++ operator and its Unicode counterpart ⧺.


Exports the ++ operator and its Unicode counterpart ⧺.


Exports the `concat` subroutine which implements the operator's functionality.


Only exports the `++` operator.


Only exports the Unicode `⧺` operator.


The double plus was chosen as the list concatenation operator due to its similarity to the `+` operator applied to lists in Python an other languages. The `++` operator is also used to concatenate lists in Elixir, Haskell, and Scala. `++` was chosen over the `@` operator used in OCaml as I thought it would be too close to the `@` sigil. The Unicode counterpart ⧺ was inspired by this StackExchange question: [Is there a common symbol for concatenating two (finite) sequences?](


Tilwa Qendov


Licensed under the [Artistic License 2.0](LICENSE).


  * `Operator::Listcat`, the module this was inspired by.