*

From the SETL Wiki

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

Contents

Purpose

Numeric product, set intersection, tuple or string replication

Synopsis

 x * y

Description

  • If x and y are both sets, returns their intersection.
  • If x and y are both numeric, returns their product. This may involve numeric promotion.
  • If one of x and y is a string or tuple and the other is an integer, the string or tuple is replicated that number of times.

Examples

  • 2 * 3
    

    Result: 6

  • 2 * 3.5
    

    Result: 7.0

  • {1, 2, 3} * {2, 3, 4}
    

    Result: {2, 3}

  • 2 * "abc"
    

    Result: "abcabc"

  • "abc" * 2
    

    Result: "abcabc"

  • 2 * [1, 2]
    

    Result: [1, 2, 1, 2]

  • [1, 2] * 2
    

    Result: [1, 2, 1, 2]

Personal tools