Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
很明显。我有以下错误。我怎样才能删除它。我需要处理所有列表。
uncaught exception Subscript [subscript out of bounds] raised at: Basis/Implementation/list.sml:...
它在 SML/NJ 中,我正在处理列表。
谢谢你。
该错误意味着您正在尝试访问具有不在列表中的索引的元素。
例如:
- List.nth([0,1,2], 7); uncaught exception Subscript [subscript out of bounds] raised at: Basis/Implementation/list.sml:47.35-47.44
您可以通过不尝试访问不存在的元素来解决此问题。您通常应该小心处理诸如List.nth, List.take, List.drop, ... 之类的函数,因为它们是部分函数,仅适用于某些输入。
List.nth
List.take
List.drop