Source

scheme-bert / README.markdown

Full commit
Yasir M. Arsanuk… 18b80da 


Yasir M. Arsanuk… b871024 
Yasir M. Arsanuk… 18b80da 


Yasir M. Arsanuk… 3de04e6 
Yasir M. Arsanuk… 18b80da 

Yasir M. Arsanuk… f9e4cab 
Yasir M. Arsanuk… 692f6d0 




Yasir M. Arsanuk… 18b80da 
Yasir M. Arsanuk… 3de04e6 
Yasir M. Arsanuk… 18b80da 

Yasir M. Arsanuk… 692f6d0 



Yasir M. Arsanuk… ed88711 
Yasir M. Arsanuk… 18b80da 




Yasir M. Arsanuk… c44f27b 
Yasir M. Arsanuk… 18b80da 
Yasir M. Arsanuk… c44f27b 
Yasir M. Arsanuk… 18b80da 
Yasir M. Arsanuk… c44f27b 



























Yasir M. Arsanuk… 18b80da 


Yasir M. Arsanuk… 2432571 
Yasir M. Arsanuk… c44f27b 
Yasir M. Arsanuk… 18b80da 
Yasir M. Arsanuk… b871024 
Yasir M. Arsanuk… c44f27b 
Yasir M. Arsanuk… b871024 

Yasir M. Arsanuk… c44f27b 
Yasir M. Arsanuk… b871024 

Yasir M. Arsanuk… 263480b 
Yasir M. Arsanuk… c44f27b 
Yasir M. Arsanuk… 263480b 


Yasir M. Arsanuk… 8f80670 
Yasir M. Arsanuk… 263480b 
Yasir M. Arsanuk… c44f27b 
Yasir M. Arsanuk… 263480b 

Yasir M. Arsanuk… 4475726 
Yasir M. Arsanuk… b871024 
Yasir M. Arsanuk… 18b80da 
Yasir M. Arsanuk… c44f27b 
Yasir M. Arsanuk… 18b80da 


Yasir M. Arsanuk… c44f27b 
Yasir M. Arsanuk… b871024 
scheme-bert
===========

scheme-bert is a BERT (Binary ERlang Term) serialization library for Scheme implementations compliant to [R^6RS](http://www.r6rs.org/implementations.html). BERT is based on Erlang's [External Term Format](http://www.erlang.org/doc/apps/erts/erl_ext_dist.html).

See the BERT specification at [bert-rpc.org](http://bert-rpc.org).

Instances of the following Scheme types will be automatically converted to the
proper simple BERT type:

* `flonum?`
* `integer?` (fixnum and bignum)
* `symbol?`
* `list?`
* `string?`
* `vector?`

Instances of the following Scheme types will be automatically converted to the
proper complex BERT type:

* `'nil`
* `#t`
* `#f`
* `hashtable?`
* `time?`


Installation
------------

Before you can use the library in your project, you have to uncomment appropriate lines of the library source depending on your Scheme implementation. This is caused by how Scheme implementations support time related functions: Racket depends on [SRFI-19](http://srfi.schemers.org/srfi-19/srfi-19.html), while Chez Scheme has a subset of those listed at the link just mentioned. A string to uncomment is in the first screenful of the source file.

* Installation in Racket

    There are several ways to install the package in Racket:

    1. Just import the package from PLaneT in your file:

            (require (planet yasir/racket-bert:1))

       This will automatically download the library from the PLaneT server and compile/install it in your system.

    1. Alternatively you can create a PLaneT package manually. There's a package skeleton in directory `./racket-bert`, where you copy `r6rs-bert.ss`. Then you need to uncomment a line in the copied source file as described above, and use the following command to create a package:

            $ raco planet create ./racket-bert/

       After the package is successfully created, put it in the Racket packages cache:

            $ raco planet fileinject "yasir" racket-bert.plt 1 0

       You may then want to remove the package from the Racket packages cache:

            $ raco planet remove "yasir" racket-bert.plt 1 0

       See [Developing Packages for PLaneT](http://doc.racket-lang.org/planet/Developing_Packages_for_PLaneT.html).

    1. The other method is to install R^6RS library manually. Use the following command: 

            $ plt-r6rs --install ./src/r6rs-bert.ss

       See [Installing Libraries](http://docs.racket-lang.org/r6rs/Installing_Libraries.html).
        

Usage
-----

Issue `(import (bert))` in your REPL or put this in the head of your R^6RS program source file. You will also probably want to import some other libraries such as `bytevectors` to be able to process byte vectors.

    > (define (bytes)
        (encode (list 'foo 13 42 (vector 666 '() 'bar))))
    > (bytes)
    #"\203l\0\0\0\4d\0\3fooa\ra*h\3b\0\0\2\232jd\0\3barj"
    > (decode (bytes))
    {foo 13 42 #(666 () bar)}
    >


Caveats
-------

Regular expressions conversion is not supported, because every Scheme comes with its own regexp implementation and I haven't found any portable library which allows one to get the source string and options of a compiled regexp.


Trivia
------

Please, drop me an email if you used or intend to use the library in your project ;-)


Copyright
---------

Copyright (c) 2010-2011 Yasir M. Arsanukaev. See LICENSE for details.