gpt4 book ai didi

erlang-shell - 在 Erlang shell 中显示长列表

转载 作者:行者123 更新时间:2023-12-03 07:46:22 25 4
gpt4 key购买 nike

当我在 Erlang shell 中调用返回长列表或元组的函数时,列表会被截断,并在末尾显示 ... 以指示还有更多元素未显示。如何让 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 - 在 Erlang shell 中显示长列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40343580/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com