unstr

From the SETL Wiki

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

Contents

Purpose

Parse a string representation of any SETL value.

Synopsis

 unstr x

Description

Given a string representation of o SETL value (the same as would be generated by str or written to a file by printa, returns that value.

Examples

  1. unstr '42'
    

    Result: 42

  2. unstr '[1 2 2]'
    

    Result: [1, 2, 2]

  3. unstr '{1 2 2}'
    

    Result: {1, 2}

  4. unstr '''a b'''
    

    Result: 'a b' (note: '' is an escaped quote character.)

  5. unstr 'a'
    

    Result: 'a'


Notes

  • Like reada, unstr cannot recreate an atom from its string representation.
  • unstr is a redefinable procedure in SETL2.

See also

Personal tools