Note: This is taken from the Chicken Wiki, where a more recent version could be available.

srfi-38

Description

A Chicken version of the reference implementation for SRFI-38, a facility for reading and writing objects with shared structure.

Author

Al Petrofsky and Ray Dillinger

Download

srfi-38.egg

Documentation

See SRFI-38 document.

This implementation extends write-with-shared-structure to accept optional flags (following the optional port argument).

Passing the keyword #:ignore-strings will treat strings as normal (nonshared) objects.

The keyword #:interesting-procedures is followed by a list of three procedures:

The interesting? procedure returns #t when the object can be processed, #f otherwise.

All optional "interesting objects" are written as

  1. <KIND-SYMBOL[OBJECT]...>. It is the job of write-interesting to display the KIND-SYMBOL and write any elements, using the first procedure, separated by #\space. Writing the elements of the object as a list or vector is advised.

The scan procedure must call the first procedure for every element of the object. The returned association-list is used for the next invocation. Returns the modified association-list.

This implementation extends read-with-shared-structure to accept optional flags (following the optional port argument).

The keyword #:interesting-procedures is followed by a list of three procedures:

The interesting? procedure returns #t when the object can be processed, #f otherwise.

The read-interesting procedure must use the first procedure to read any elements of the object. The symbol is the KIND-SYMBOL. The procedure should return #f for an unsuccessful operation, otherwise the reified object. The procedure must not consume the trailing #\> but must exit positioned at the trailing #\>. The input-port is positioned just after the KIND-SYMBOL upon invocation.

The scan procedure must call the second procedure for every element of the object when the element is a procedure, otherwise it must call the first procedure with the element.

Changelog

License

Copyright © Ray Dillinger 2003. All Rights Reserved.

This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Scheme Request For Implementation process or editors, except as needed for the purpose of developing SRFIs in which case the procedures for copyrights defined in the SRFI process must be followed, or as required to translate it into languages other than English.

The limited permissions granted above are perpetual and will not be revoked by the authors or their successors or assigns.

This document and the information contained herein is provided on an "AS IS" basis and THE AUTHOR AND THE SRFI EDITORS DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.