On this page:
Package Scone
1.0

Package Scone🔗ℹ

Simon Johnston <johnstonskj@gmail.com>

SCONE - SCheme Object Notation (Economized) is a simple file format that is a strict subset of the Scheme language and is intended to be parsed directly by the Scheme reader. The intent is to be a Scheme-friendly replacement for file types such as CSV or JSON where simple tabular data is stored or exchanged.

This package provides the core data types as well as read and write capabilities and simple query over the in-memory representation.

Example

> (define names-list (read-table-from-file "./tests/names-list.scone"))
> (describe names-list)

CREATE EXTERNAL TABLE unnamed_1 (

    code_point number,

    name string,

    syntax symbol,

    decomposition LISTOF number,

    aliases LISTOF string,

    formal_aliases LISTOF string,

    xref LISTOF string,

)

STORED AS scone

WITH HEADER ROW;

> (define (has-decomposition _1 _2 _3 dc . __) (not (null? dc)))
> (define selected
    (select
     '(code_point decomposition name)
     #:from     names-list
     #:where    has-decomposition
     #:order-by '(name . desc)
     #:as       'names-with-dc))
> (describe selected)

CREATE EXTERNAL TABLE names-with-dc (

    code_point number,

    decomposition LISTOF number,

    name string,

)

STORED AS scone

WITH HEADER ROW;

Why another File Format?

The Reader in The Racket Reference introduces the Racket reader.

Simplicity. I didn’t want to write a lexer/parser when Racket/Scheme has a perfectly good one already in the reader. Use a simple set of types, simple serialization and some high-level tools and it just works.

Contents

    1 Tables

      1.1 Table Types

        1.1.1 Rows and Values

      1.2 Table Definition

      1.3 Column Definition

      1.4 Table Contracts

      1.5 Table Defaults

    2 Table I/O

      2.1 Reading

      2.2 Display

      2.3 Writing

      2.4 I/O Contracts

      2.5 I/O Defaults

    3 Table Queries

      3.1 Select

      3.2 Pivot

      3.3 Describe

      3.4 Query Contracts

      3.5 Query Defaults

    4 License

      4.1 Apache

      4.2 MIT