在 Erlang 中显示长列表 shell
Displaying long lists in the Erlang shell
当我在 Erlang shell 中调用 returns 长列表或元组的函数时,列表被截断,在末尾显示 ...
以指示有更多元素未显示。如何让 shell 显示整个列表?
例如:当键入 code:module_info().
时,将返回以下内容:
[{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>>}]
我希望扩展 {set_path,...}, {...}|...]},
以显示 shell 中的整个列表。
使用内置shell函数rp/1
,例如:
rp(code:module_info()).
rp(Term)
等同于 io:format("~p", [Term])
它将打印您提供的任何 erlang-term。有关详细信息,请参阅类似问题 here。
当我在 Erlang shell 中调用 returns 长列表或元组的函数时,列表被截断,在末尾显示 ...
以指示有更多元素未显示。如何让 shell 显示整个列表?
例如:当键入 code:module_info().
时,将返回以下内容:
[{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>>}]
我希望扩展 {set_path,...}, {...}|...]},
以显示 shell 中的整个列表。
使用内置shell函数rp/1
,例如:
rp(code:module_info()).
rp(Term)
等同于 io:format("~p", [Term])
它将打印您提供的任何 erlang-term。有关详细信息,请参阅类似问题 here。