[GAP Forum] ListX error: "... must be a collection, a boolean, or a function ..."
Mark Dickinson
dickinsm at gmail.com
Mon Dec 14 14:16:37 GMT 2009
Dear GAP forum,
I'm a bit confused by an apparent mismatch between the documentation
for the ListX function and its actual behaviour. The documentation
(section 21.21 of the reference manual) says that
"Each of the arguments [to ListX] must be one of the following:
a list or collection [...]
a function returning a list or collection [...]
a function returning true or false [...]
"
But in practice, it seems that only collections are permissible, while
general lists are not. Here's an example, using Gap 4.4.12:
gap> square := function(x) return x*x; end;
function( x ) ... end
gap> ListX([1..10], square);
[ 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 ]
So far, so good; this is what I expected. But now if I try to replace
[1..10] with an empty list, I get an error:
gap> ListX([], square);
Error, gens[1] must be a collection, a boolean, or a function called from
ListXHelp0( result, arg, 0 ); called from
<function>( <arguments> ) called from read-eval-loop
Entering break read-eval-print loop ...
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
I was expecting to get the empty list as a result of this operation. Is
this a bug in GAP, a bug in the documentation, or a bug in my
understanding?
Thanks,
Mark
More information about the Forum
mailing list