有没有办法直接在erl中使用记录?无论我尝试什么,它总是说它找不到记录。我正在尝试进行记忆交易,如果没有我的记录,我不能走得太远。非常感谢任何帮助 - 谢谢!
问问题
1773 次
2 回答
14
是的,使用 help() 并在 shell 中找到这些命令。
rd(R,D) -- define a record
rf() -- remove all record information
rf(R) -- remove record information about R
rl() -- display all record information
rl(R) -- display record information about R
rp(Term) -- display Term using the shell's record information
rr(File) -- read record information from File (wildcards allowed)
rr(F,R) -- read selected record information from file(s)
rr(F,R,O) -- read selected record information with options
这些是 shell 中的一个巧妙的 hack,它们允许您在编译模块时加载模块中使用的记录定义。使用 rr 命令从您的模块中加载它。
请记住,这些仅供交互式 shell 使用。
于 2009-09-06T17:45:52.237 回答
4
你是什么意思?在外壳中,就像克里斯蒂安所写的那样。如果您的意思是在模块中,那么您仍然必须先定义记录才能使用它们。有关如何执行此操作的说明,请参见http://erlang.org/doc/上的在线 erlang 文档。它们只是编译时构造,因此它们不存在。
于 2009-09-07T00:03:13.783 回答