Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » operators » #
next | previous | forward | backward | up | index | toc

# -- length or access to elements

Description

# is used as both a unary and a binary operator.

As a unary operator: #x returns the length or cardinality of a list, set, hash table, or string x.

As a binary operator: x#i returns the ith element of a list, hash table, database, or string x.

i1 : L = {23, 42, 107, 2, 50};
i2 : #L

o2 = 5
i3 : L#2

o3 = 107

Caveat

The precedence of # when used as a binary operator is high, as high as ., but when used as a unary operator the precedence is much lower.

See also

Ways to use symbol #:

  • # BasicList -- see # List -- length or cardinality of a list, hash table, dictionary, set, or string
  • # Dictionary -- see # List -- length or cardinality of a list, hash table, dictionary, set, or string
  • # HashTable -- see # List -- length or cardinality of a list, hash table, dictionary, set, or string
  • # List -- length or cardinality of a list, hash table, dictionary, set, or string
  • # Net -- see # List -- length or cardinality of a list, hash table, dictionary, set, or string
  • # Sequence -- see # List -- length or cardinality of a list, hash table, dictionary, set, or string
  • # Set -- see # List -- length or cardinality of a list, hash table, dictionary, set, or string
  • # String -- see # List -- length or cardinality of a list, hash table, dictionary, set, or string
  • BasicList # ZZ -- see List # ZZ -- get value from list, hash table, database, dictionary, or string
  • Database # String -- see List # ZZ -- get value from list, hash table, database, dictionary, or string
  • Dictionary # String -- see List # ZZ -- get value from list, hash table, database, dictionary, or string
  • HashTable # Thing -- see List # ZZ -- get value from list, hash table, database, dictionary, or string
  • List # ZZ -- get value from list, hash table, database, dictionary, or string
  • Net # ZZ -- see List # ZZ -- get value from list, hash table, database, dictionary, or string
  • Sequence # ZZ -- see List # ZZ -- get value from list, hash table, database, dictionary, or string
  • String # ZZ -- see List # ZZ -- get value from list, hash table, database, dictionary, or string

For the programmer

The object # is a keyword.


The source of this document is in Macaulay2Doc/ov_hashtables.m2:706:0.