Jump to content

Apply a callback to an array: Difference between revisions

Frink
(Frink)
Line 917:
<lang fp>{square * . [id, id]}
& square: <1,2,3,4,5></lang>
 
=={{header|Frink}}==
<lang frink>
f = {|x| x^2} // Anonymous function to square input
a = [1,2,3,5,7]
println[map[f, a]]
</lang>
 
=={{header|F_Sharp|F#}}==
490

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.