Abstract form

Richard Carlsson richardc@REDACTED
Fri Dec 30 11:53:07 CET 2005


Vlad Dumitrescu XX (LN/EAB) wrote:
> I don't usually complain about things ;-) but I find this rather annoying.
>  
> erl_parse:abstract([3,a,5]). --->
>   {cons,0,{integer,0,3},{cons,0,{atom,0,a},{string,0,[5]}}}
> erl_parse...("[3,a,5]"). --->
>   {cons,1,{integer,1,3},{cons,1,{atom,1,a},{cons,1,{integer,1,5},{nil,1}}}}
> I would expect the result to be the same, but abstract/1 treats lists of
> integers as strings, while erl_parse doesn't (the latter being IMHO
> correct).

Try erl_syntax:abstract/1 instead - I think it tries to avoid creating
"mixed" representations. You may have to use erl_syntax:revert/1 on the
result if you want the representation to be erl_parse-compatible.

	/Richard



More information about the erlang-questions mailing list