Loading

TYPEOF

stack debug

Gets the type of an element.

The TYPEOF function consumes the top element on the stack and pushes back a string containing the type. The output could be:

  • AGGREGATOR
  • BITSET
  • BOOLEAN
  • BYTES
  • CONTEXT
  • COUNTER
  • DOUBLE
  • FILLER
  • FILTER
  • FUNCTION
  • GEOSHAPE
  • GTS
  • GTSENCODER
  • KEY
  • LIST
  • LONG
  • MACRO
  • MAP
  • MARK
  • MATCHER
  • MATRIX
  • NULL
  • OPERATOR
  • PFONT
  • PGRAPHICS
  • PIMAGE
  • PSHAPE
  • SET
  • STRING
  • VECTOR
  • VLIST

For any object introduced by a WarpScript extension whose output of TYPEOF is not in the list thereof, the output would be preceded by "X-".

Note: since revision 2.5.0, the TYPEOF output of bucketizers, mappers, reducers is changed from 'MAPPER' to 'AGGREGATOR'.

TYPEOF is available since version 1.0.0.

Signatures

Examples

// NULL NULL TYPEOF // STRING "hello" TYPEOF // LONG 42 TYPEOF // DOUBLE pi TYPEOF // BOOLEAN 2 2 == TYPEOF // LIST [ 4 ] 'c' + TYPEOF // MAP { 'key' 42.3 } TYPEOF // MACRO <% DROP %> TYPEOF // MAPPER mapper.sigmoid TYPEOF // REDUCER reducer.count TYPEOF // GTS NEWGTS TYPEOF // BYTES 'hello' 'UTF8' ->BYTES TYPEOF // PGRAPHICS 2 2 '2D' PGraphics TYPEOF // GEOSHAPE 'POLYGON ((-4.574435 48.641404, -4.565680 48.641404, -4.565680 48.636101, -4.574435 48.636101, -4.574435 48.641404 ))' 0.1 true GEO.WKT TYPEOF // SET ( 5 7 ) TYPEOF // BITSET '0010110001000011' BIN-> BYTESTOBITS TYPEOF 'BITSET' == ASSERT // VLIST [ 'ss' 42 ] ->V TYPEOF // VECTOR [ 4 5.5 ] ->VEC TYPEOF // MATRIX [ [ 42 41 40 42.42 ] [ 42 41 40 0.2 ] [ 42 41 40 42.42 ] ] ->MAT TYPEOF