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

From Esolang
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⟩
   
   
   - (1 argument)
         Number a: Multiply by -1
             e.g. -5      # => ¯5
   - (2 arguments)
         Number a, Number b: Subtraction
             e.g. 5 - 3   # => 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"
   
   
   ÷ (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"⟩