gpt4 book ai didi

scheme - 列出方案中所有用户定义的变量

转载 作者:行者123 更新时间:2023-12-04 11:41:53 25 4
gpt4 key购买 nike

在 python 中,我可以使用 dir()在 Racket (5.2)中我可以做到

 (require xrepl)
,apropos

获取所有已定义变量的列表。在所有方案中都有什么可移植的方法来做同样的事情?完成后,如何过滤掉所有系统和模块变量?变量的完整列表在 Racket 中相当令人生畏。

最佳答案

要获取 Racket 中特定模块导出的名称,请使用 module->exports .对于其他实现,您需要在文档中查找。

> (module->exports 'racket/list)
'((0
(add-between ()) (append* ()) (append-map ())
(argmax ()) (argmin ()) (cons? ()) (count ())
(drop ()) (drop-right ()) (eighth ()) (empty ())
(empty? ()) (fifth ()) (filter-map ())
(filter-not ()) (first ()) (flatten ())
(fourth ()) (last ()) (last-pair ())
(make-list ()) (ninth ()) (partition ())
(range ()) (rest ()) (second ())
(seventh ()) (shuffle ()) (sixth ())
(split-at ()) (split-at-right ()) (take ())
(take-right ()) (tenth ()) (third ())))
'((0 (remove-duplicates ())))

关于scheme - 列出方案中所有用户定义的变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10898180/

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