GAP-system: Generate a list of duplicate elements

24 views Asked by At

Maybe this question sounds stupid, but is there a function which e.g. takes the inputs a and 5 and outputs a list [a,a,a,a,a] in GAP-system, similar to numpy.full() in python?

I have searched extensively in the GAP manual, but to no avail. I could write something like

Full := function(elem, length)
  local l, k;
  l := [];
  for k in [1..length] do
    l[k] := elem;
  od;
end;

but isn't there a built-in function for this??? Any help will be appreciated!

0

There are 0 answers