partial binary_to_term?

Carsten Schultz carsten@REDACTED
Sat Jan 29 17:58:27 CET 2005


I think it would be useful to have a function that interprets only the
top level of a term in external term format.  For example with

    T1 = {S0, S1, S2},
    T2 = [S3, S4, S5],
    B1 = term_to_binary(T1),
    B2 = term_to_binary(T2)

one head_binary_to_term(B1) would yield the same result as
{term_to_binary(S0), term_to_binary(S1), term_to_binary(S2)}, of
course without un- and repacking.  Similarly, head_binary_to_term(T2)
would yield [term_to_binary(S3) | term_to_binary([S4, S5])].

For example imagine that you are receiving a list of large terms from
an external process and want to distribute its contents to several
other processes.  You could keep the parts packed when passing them

Just a thought,


Carsten Schultz (2:38, 33:47)
PGP/GPG key on the key servers, 
fingerprint on my home page.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <>

More information about the erlang-questions mailing list