proj-plbook-plChOps

Table of Contents for Programming Languages: a survey

Providing binary operators on existing objects

See https://news.ycombinator.com/item?id=23664724 for a discussion of various ways to do this, including:

Meta-operators

In Perl6, 'meta-operators' can be combined together to specify an operator (infix function):

eg.

  1. list of pairs using the zip meta-operator (Z)
  2. combined with the pair constructor operator (=>) my @a = 'a'..'z' Z=> 0..*; # ( a => 0, b => 1, etc )
  3. deck of cards using the cross meta-operator (X)
  4. and the string concatenation operator (~) my @deck = 2..10,<J Q K A> X~ <♡ ♢ ♣ ♠>;

(thanks [3])