This repository has been archived by the owner on Oct 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
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 }
Please refer to the [F#] (https://github.com/theburningmonk/Filbert/wiki/Encoding-and-Decoding-BERT-in-F%23) and C# examples.