cardinality

From the SETL Wiki

Jump to: navigation, search
#
Category set, string, tuple
Syntax function
Compatibility
CIMS SETL yes
SETL-S yes
SETL2 yes
GNU SETL yes

Contents

Purpose

Size of string, set or tuple

Synopsis

 #x

Description

  • If x is a string, returns its length in bytes
  • If x is a tuple, returns the maximum index
  • If x is a set, returns the number of elements

Examples

  • # "abc"
    

    Result: 3

  • # [1, 2, 3, 4]
    

    Result: 4

  • # {1, 2}
    

    Result: 2


Notes

  • This page is called cardinality because '#' is not a valid page name in MediaWiki.
Personal tools