RosettaCodeData/Task/Apply-a-callback-to-an-array/Logo/apply-a-callback-to-an-arra...

7 lines
192 B
Plaintext

to square :x
output :x * :x
end
show map "square [1 2 3 4 5] ; [1 4 9 16 25]
show map [? * ?] [1 2 3 4 5] ; [1 4 9 16 25]
foreach [1 2 3 4 5] [print square ?] ; 1 4 9 16 25, one per line