partial binary_to_term?

Carsten Schultz <>
Sat Jan 29 17:58:27 CET 2005


Hi,

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
on.

Just a thought,

Carsten

-- 
Carsten Schultz (2:38, 33:47)
http://carsten.codimi.de/
PGP/GPG key on the pgp.net 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: <http://erlang.org/pipermail/erlang-questions/attachments/20050129/09594f03/attachment.bin>


More information about the erlang-questions mailing list