Logo

Programming-Idioms

  • Python
for i, x in enumerate(elements):
    elements[i] = x * c
elements = [c * x for x in elements]

This maps the lambda function that multiplies a number by c to the list elements , and overwrites the old list
f = lambda x: x * c
elements = [*map(f, elements)]
for E of elements loop
   E := E * c;
end loop;

New implementation...
< >
Bzzzzzzzzz