partial binary_to_term?
Carsten Schultz
carsten@REDACTED
Sun Jan 30 12:19:37 CET 2005
On Sun, Jan 30, 2005 at 11:45:13AM +0100, Tony Rogvall wrote:
> On Jan 29, 2005, at 5:58 PM, Carsten Schultz wrote:
> >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])].
> >
>
> If I understand you correctly this is actually possible (easy) to
> implement in erlang!
> You need to find the spec's of the external format and write a library.
Yes, you are right. Having thought about it for a minute, it seems
slightly less attractive to me, because to get for example the head of
a cons cell you have to parse it completely to determine its length.
Thanks for the input,
Carsten
P.S.: If anyone is interested in my Haskell library that deals wirth
Erlang terms end external term format...
--
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/20050130/d3e38072/attachment.bin>
More information about the erlang-questions
mailing list