denotype

From the SETL Wiki

Jump to: navigation, search
denotype
Category string
Syntax prefix
Compatibility
CIMS SETL no
SETL-S no
SETL2 no
GNU SETL yes

Contents

Purpose

Determine the type of value that would be parsed from a string by unstr

Synopsis

 denotype s

Description

Returns the name of the type of the value denoted in the string s, if any.
Almost equivalent to type(unstr s), except that it returns om if s contains invalid input to unstr, i.e. if s is not the string representation of a valid SETL value.

Examples

  • denotype '42'
    

    Result: 'INTEGER'

  • denotype '[][[[1!@#$'
    

    Result: om

  • numbers := [unstr line: line in split(getfile('numbers.txt'), "\n"), t in {denotype(line)} | t = "INTEGER"];
    

    Returns a tuple. For each line of in "numbers.txt" that contains a decimal integer, that integer value is included in the tuple.

Personal tools