[erlang-questions] Pretty printing records
Thu Nov 20 17:44:26 CET 2008
You can use the same function as the shell, namely:
where RecDefFun is a fun/2:
fun(Tag, NoOfFields) -> [FieldTag] | no
The RecDefFun can be somewhat generalized through use of
the exprecs parse transform.
This is (almost) described in:
You could make a module that includes definitions of all
relevant records, and "exports" them using exprecs.
Then you could modify the code in the example so that it
returns 'no' for terms that are not representations of some
2008/11/20 Vance Shipley <vances@REDACTED>:
> The shell now does a nice job of pretty printing records,
> once you've loaded them with rr(). Currently I'm writing
> test suites using common_test and would love the web page
> reports generated to pretty print the (record) return values.
> Is there any easy way to do that?
> erlang-questions mailing list
More information about the erlang-questions