CodeWarrior
CodeWarrior

Reputation: 538

Displaying long lists in the Erlang shell

When I call functions that returns long lists or tuples in the Erlang shell, the lists gets truncated, displaying ... at the end to indicate there is more elements that is not shown. How do I get the shell to display the entire list?

For example: when typing code:module_info()., the following is returned:

[{module,code},
 {exports,[{objfile_extension,0},
           {load_file,1},
           {load_abs,1},
           {load_abs,2},
           {load_binary,3},
           {load_native_partial,2},
           {load_native_sticky,3},
           {delete,1},
           {purge,1},
           {soft_purge,1},
           {get_object_code,1},
           {stop,0},
           {root_dir,0},
           {lib_dir,0},
           {lib_dir,1},
           {lib_dir,2},
           {compiler_dir,0},
           {priv_dir,1},
           {stick_dir,1},
           {unstick_dir,1},
           {stick_mod,1},
           {unstick_mod,1},
           {is_sticky,1},
           {set_path,...},
           {...}|...]},
 {attributes,[{vsn,[225576456026721604984939683025195514980]},
              {deprecated,[{rehash,0,next_major_release}]}]},
 {compile,[{options,[{outdir,"/net/isildur/ldisk/daily_build/19_prebuild_master-opu_o.2016-06-21_20/otp_src_19/lib/kernel/src/../ebin"},
                     {i,"/net/isildur/ldisk/daily_build/19_prebuild_master-opu_o.2016-06-21_20/otp_src_19/lib/kernel/src/../include"},
                     warnings_as_errors,debug_info]},
           {version,"6.0.3"},
           {source,"/net/isildur/ldisk/daily_build/19_prebuild_master-opu_o.2016-06-21_20/otp_src_19/lib/kernel/src/code.erl"}]},
 {md5,<<169,180,113,244,195,188,176,68,162,6,74,100,65,
        30,60,100>>}]

I would like the {set_path,...}, {...}|...]}, to be expanded to display the entire list in the shell.

Upvotes: 4

Views: 2147

Answers (1)

Limmen
Limmen

Reputation: 1457

Use built-in shell function rp/1, e.g:

 rp(code:module_info()). 

rp(Term) is equivalent to io:format("~p", [Term]) which will print what ever erlang-term you provide. See similar question here for more detail.

Upvotes: 8

Related Questions