Adding SRFI 28 documentation

This commit is contained in:
Koz Ross 2017-02-10 18:45:34 +13:00
parent 196410a320
commit 151cb0d79e
3 changed files with 53 additions and 3 deletions

View file

@ -32,11 +32,12 @@ This section of the Cyclone API is based on the [R<sup>7</sup>RS Scheme Specific
Cyclone supports the following [Scheme Requests for Implementation (SRFI)](http://srfi.schemers.org/) libraries. Detailed information is available in the linked SRFI page as well as the provided Cyclone API:
- [`srfi 1`](api/srfi/1.md) - [List Library](http://srfi.schemers.org/srfi-1/srfi-1.html)
- [`srfi 1`](api/srfi/1.md) - [List library](http://srfi.schemers.org/srfi-1/srfi-1.html)
- [`srfi 2`](api/srfi/2.md) - [`and-let*`](http://srfi.schemers.org/srfi-2/srfi-2.html)
- [`srfi 8`](api/srfi/8.md) - [`receive`: Binding to multiple values](http://srfi.schemers.org/srfi-8/srfi-8.html) - Included as part of `scheme base`.
- [`srfi 18`](api/srfi/18.md) - [Multithreading support](http://srfi.schemers.org/srfi-18/srfi-18.html)
- [`srfi 27`](api/srfi/27.md) - [Sources of random bits](http://srfi.schemers.org/srfi-27/srfi-27.html)
- [`srfi 28`](api/srfi/28.md) - [Basic format strings](http://srfi.schemers.org/srfi-28/srfi-28.html)
- [`srfi 60`](api/srfi/60.md) - [Integers as bits](http://srfi.schemers.org/srfi-60/srfi-60.html)
- [`srfi 69`](api/srfi/69.md) - [Basic hash tables](http://srfi.schemers.org/srfi-69/srfi-69.html)
- [`srfi 106`](api/srfi/106.md) - [Basic socket interface](http://srfi.schemers.org/srfi-106/srfi-106.html)
@ -44,8 +45,8 @@ Cyclone supports the following [Scheme Requests for Implementation (SRFI)](http:
- [`srfi 113`](api/srfi/113.md) - [Sets and bags](http://srfi.schemers.org/srfi-113/srfi-113.html)
- [`srfi 117`](api/srfi/117.md) - [Mutable queues](http://srfi.schemers.org/srfi-117/srfi-117.html)
- [`srfi 128`](api/srfi/128.md) - [Comparators](http://srfi.schemers.org/srfi-128/srfi-128.html)
- [`srfi 132`](api/srfi/132.md) - [Sort Libraries](http://srfi.schemers.org/srfi-132/srfi-132.html)
- [`srfi 133`](api/srfi/133.md) - [Vector Library (R7RS-compatible)](http://srfi.schemers.org/srfi-133/srfi-133.html)
- [`srfi 132`](api/srfi/132.md) - [Sort libraries](http://srfi.schemers.org/srfi-132/srfi-132.html)
- [`srfi 133`](api/srfi/133.md) - [Vector library (R7RS-compatible)](http://srfi.schemers.org/srfi-133/srfi-133.html)
# Cyclone Libraries

47
docs/api/srfi/28.md Normal file
View file

@ -0,0 +1,47 @@
# SRFI 28 - Basic format strings
Specifies a method of interpreting a Scheme string which contains a number of
escape sequences, into which other data is interpolated according to the
semantics of each sequence.
See the [SRFI document][1] for more information.
## Limitations
Currently, this translates newline escape sequences into LF. This may cause
issues if this is ever used on Windows (which expects CRLF instead). Given that
Cyclone does not currently support Windows, this issue should not arise in
practice.
## Interface
# format
(format format-string [obj ...])
Processes ``format-string``, replacing any escape sequences in order with one or
more characters. These characters depend on the semantics of the escape
sequence.
An 'escape sequence' is a two-character sequence in ``format-string``, where the
first character is a tilde ('~'). The following are all of the valid escape
codes, as well as their semantics:
- ``~a``: The corresponding value is inserted into the string as if printed by
``display``.
- ``~s``: The corresponding value is inserted into the string as if printed by
``write``.
- ``~%``: A newline is inserted.
- ``~~``: A literal tilde is inserted.
``~a`` and ``~s``, when encountered, require a corresponding Scheme value to be
present as an argument to ``format``. The values provided in ``obj ...`` are
used by the escape sequences in order. It is an error if fewer values are
provided than escape sequences which require them. ``~%`` and ``~~`` do not need
a corresponding value.
Example: The call ``(format "This is the ~ast example: ~s~%" 1 '(foo bar 17))``
would produce the string ``"This is the 1st example: (foo bar 17)
"`` (note the newline).
[1]: http://srfi.schemers.org/srfi-28/srfi-28.html

View file

@ -42,6 +42,8 @@ See the [SRFI document][1] for more information.
[`list->integer`](#list-integer)
[`booleans->integer`](#booleans-integer)
## Interface
# logand
(logand n1 ...)