Home

theburningmonk edited this page Aug 22, 2012 · 8 revisions

The different BERTs are represented as a single discriminated union in the Filbert.Core namespace:

type Bert =
    | Integer       of int      // 4
    | BigInteger    of bigint   // 12345678901234567890123456789
    | Float         of float    // 8.1516
    | Atom          of string   // foo
    | Tuple         of Bert[]   // { coord, 23, 42 }
    | EmptyArray                // this is the primitive Nil, which in Erlang equals to []
    | ByteList      of byte[]   // [ 1, 2, 3 ]
    | List          of Bert[]   // [ a, [ 1, 2 ] ]
    | Binary        of byte[]   // <<"Roses are red\0Violets are blue">>
    | Nil                       // { bert, nil }
    | Boolean       of bool     // { bert, true } or { bert, false }
    // Dictionary args : a map where both key and value can be any BERT term
    | Dictionary    of Map<Bert, Bert>  // { bert, dict, [{name, <<"Tom">>}, {age, 30}]}
    // Time args : megaseconds (millions of seconds) * seconds * microseconds (millionth of a second)
    | Time          of DateTime         // { bert, time, 1255, 295581, 446228 }

Encoding/Decoding BERT

Please refer to the F# and C# examples.

Making BERT-RPC calls

Please refer to the F# and C# examples.