with

From the SETL Wiki

Jump to: navigation, search
with
Category set, tuple
Syntax infix
Compatibility
CIMS SETL yes
SETL-S yes
SETL2 yes
GNU SETL yes

Contents

Purpose

Add a member to a set, or append an element to a tuple

Synopsis

 a with x

Description

Either:

  • a must be a set, and the result is a set whose members are x and all members of a or
  • a must be a tuple, and the result is a tuple with the element x appended on the right-hand end.

Whether a is a set or a tuple, "a with om" is equivalent to "a".

Examples

  1. {1, 2} with 3
    

    Result: {1, 2, 3}

  2. {1, 2} with 2
    

    Result: {1, 2}

  3. {1, 2} with om
    

    Result: {1, 2}

  4. [1, 2] with 3
    

    Result: [1, 2, 3]

  5. [1, 2] with 2
    

    Result: [1, 2, 2]

  6. [1, 2] with om
    

    Result: [1, 2]

Personal tools