Apply a callback to an array: Difference between revisions

add language: Retro
No edit summary
(add language: Retro)
Line 1,309:
Applying native function with 'map':
ok [[2 4 6] = map :square-root [4 16 36]]</pre>
 
=={{header|Retro}}==
Using the '''array'''' library to multiply each value in an array by 10 and display the results:
 
<lang Retro>[ 1 2 3 4 5 ] ^array'fromQuote [ 10 * ] ^array'map ^array'display</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|RLaB}}==
Anonymous user