Apply a callback to an array: Difference between revisions

→‎{{header|Retro}}: update for retro12
(→‎{{header|Retro}}: update for retro12)
Line 2,501:
 
=={{header|Retro}}==
Using the '''array'''' library to multiply each value in an array by 10 and display the results:
 
<lang Retro>[ 1provides 2a 3variety 4of 5array ]words. ^array'fromQuoteUsing [these 10to *multiply ]each ^array'mapvalue in an ^array' by 10 and display</lang> the results:
 
<lang Retro>{ #1 #2 #3 #4 #5 } [ #10 * ] a:map [ n:put sp ] a:for-each</lang>
Retro also provides '''^array'apply''' for use when you don't want to alter the contents of the array:
 
<lang Retro>[ "Hello" "World" "Foo" ] ^array'fromQuote [ "%s " puts ] ^array'apply</lang>
 
=={{header|REXX}}==
Anonymous user