We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
CollaborativePL/Operators
Jump to navigation
Jump to search
Here is a comprehensive list of operators in CollaborativePL:
Operators in CollaborativePL can have one or two arguments.
In each use of each operator, "a" is the left argument and "b" is the right argument.
+ (2 arguments)
Number a, Number b: Addition
e.g. 5 + 3 # => 8
String a, String b: Concatenation
e.g. "Hello, " + "World!" # => "Hello, World!"
List a, List b: Concatenation
e.g. ⟨1, 2, 3⟩ + ⟨4, 5, 6⟩ # => ⟨1, 2, 3, 4, 5, 6⟩
List a, Any other thing b: Append
e.g. ⟨1, 2, 3⟩ + "明月几时有" # => ⟨1, 2, 3, "明月几时有"⟩
- (1 argument)
Number a: Multiply by -1
e.g. -5 # => ¯5
Boolean a: Logical NOT gate
e.g. -(1+1=2)# => false
- (2 arguments)
Number a, Number b: Subtraction
e.g. 5 - 3 # => 2
List a, List b: Set difference, return a∖b
e.g. ⟨1, 2, 3, 4⟩ - ⟨3, 4⟩ # => ⟨1, 2⟩
× (2 arguments)
Number a, Number b: Multiplication
e.g. 5 × 3 # => 15
String a, Number b: Repeat the string
e.g. "A" × 3 # => "AAA"
List a, Number b: Repeat the list
e.g. ⟨1, 2⟩ × 3 # => ⟨1, 2, 1, 2, 1, 2⟩
List a, String b: Join
e.g. ⟨"This", "is", "a", "string"⟩ × "-" # => "This-is-a-string"
List a, List b: Return a∩b
e.g. ⟨1, 2, 3, 4⟩ × ⟨5, 6, 7, 8⟩ # => ⟨⟩
÷ (2 arguments)
Number a, Number b: Float division
e.g. 3 ÷ 5 # => 0.6
String a, String b: Split
e.g. "String of words" ÷ " " # => ⟨"String", "of", "words"⟩
^ (1 argument)
Number a, Raise e to the power of a
e.g. ^1 # => 2.71828
^ (2 arguments)
Number a, Number b: Exponent
e.g. 114514 ^ 2 # => 13113456196
% (2 arguments)
Number a, Number b: Modulo
e.g. 10 % 3 # => 2
String a, List b: Format using sprintf
e.g. "%d + %d = %d" % ⟨3, 4, 7⟩ # => "3 + 4 = 7"
List a, Number b: Every bth item of a
e.g. ⟨"a", "b", "c", "d", "e"⟩ % 2 # => ⟨"a", "c", "e"⟩