我对列表中的漏洞有疑问。假设我有以下代码:
gap> l:=[2,3,,5];
[ 2, 3,, 5 ]
gap> for i in [1..Size(l)] do
> Print(l[i],"\n");
> od;
2
3
Error, List Element: <list>[3] must have an assigned value in
Print( l[i], "\n" ); at *stdin*:13 called from
<function "unknown">( <arguments> )
called from read-eval loop at *stdin*:14
you can 'return;' after assigning a value
在尝试访问列表的第 i 个元素之前,是否有一些功能可以查找它是否是孔?我正在寻找这样的东西:
gap> for i in [1..Size(l)] do
> if IS_HOLE(l[i])=true then Print("Hole \n); else Print(l[i],"\n"); fi;
> od;
我已经阅读了手册,但仍然不知道如何处理这个问题。请问有人可以提出一些解决这个问题的方法吗?