[erlang-questions] [HOWTO] For newbies: print any term without ellipsis in shell using rp()

Edwin Fine erlang-questions_efine@REDACTED
Fri Aug 29 05:23:20 CEST 2008


I just stumbled across this and found it so useful that I thought other
Erlang newbies might, too. This info is in fact in the erlang-questions
archives, but quite rare (< 10 results that I could find).

I've always used io:format("~p\n", [X]) to print X in the shell when X is a
largish term that the shell truncates. Using io:format for this is a pain in
the rear, especially for lazy typists like me.

> mnesia:start(), X = mnesia:system_info(all).
[{access_module,mnesia},
 {auto_repair,true},
++++ .... rows deleted for brevity ...
 {schema_location,opt_disc},
* {schema_version,...},
 {...}|...] %% Arghhh!!!!
*
Instead of using io:format, one can use the shell record print command (rp).
It works for any term and requires minimal typing.

>rp(X).
[{access_module,mnesia},
 {auto_repair,true},
++++ .... rows deleted for brevity ...
 {schema_location,opt_disc},
* {schema_version,{2,0}},*
 {subscribers,[<0.37.0>]},
 {tables,[schema]},
 {transaction_commits,2},
 {transaction_failures,0},
 {transaction_log_writes,0},
 {transaction_restarts,0},
 {transactions,[]},
 {use_dir,false},
 {core_dir,false},
 {no_table_loaders,2},
 {dc_dump_limit,4},
 {version,"4.4.3"}]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080828/ac2e669d/attachment.htm>


More information about the erlang-questions mailing list