The SExp structure
Author: John Reppy
Keywords: Standard ML, SML, SML/NJ Library

The SML of NJ Library
The `SExp` structure

The `SExp` structure defines the tree representation of S-expression data.

## Synopsis

    structure SExp

## Interface

    datatype value
      = SYMBOL of Atom.atom
      | BOOL of bool
      | INT of IntInf.int
      | FLOAT of real
      | STRING of string
      | QUOTE of value
      | LIST of value list

    val same : value * value -> bool
    val compare : value * value -> order

## Description

`datatype value = …​`

  This datatype represents S-expression trees. The constuctors are defined as follows:

  `SYMBOL of Atom.atom`

    represents an identifier. We use the `atom` type to represent these for fast equality testing.

  `BOOL of bool`

    represents a boolean literal.

  `INT of IntInf.int`

    represents an integer number.

  `FLOAT of real`

    represents a floating-point number.

  `STRING of string`

    represents a string value.

  `QUOTE of value list`

    represents a quoted value.

  `LIST of value list`

    represents a list of values.

`val same : value * value -> bool`

  `same (se1, se2)` compares `se1` and `se2` for equality and returns true if, and only if, they are equal.

`val compares : value * value -> order`

  `same (se1, se2)` compares `se1` and `se2` for their order.

## See Also

`SExpParser`, `SExpPP`, `SExpPrinter`, The SExp Library

SML/NJ Version 110.99.9 (November 4, 2025)
Last updated 2025-11-04 15:48:25 UTC