Skip to content

Instantly share code, notes, and snippets.

@heath
Last active December 16, 2015 17:38
Show Gist options
  • Save heath/5471346 to your computer and use it in GitHub Desktop.
Save heath/5471346 to your computer and use it in GitHub Desktop.
Maps in various languages
[1,2,3].map((n)=> n*2)
(map #(%*2) '(1 2 3))
[1,2,3].map (n) -> n*2
vector<int> m {3, 4, 5}; for_each(m.begin(), m.end(), [](int n) { return n * 2; });
map(fun(n) -> n*2 end, [1,2,3])
map (2*) [1,2,3]
(mapcar (lambda (n) (* n 2)) '(1 2 3))
List.map (fun x -> x * 2) [1; 2; 3]
array_map(function($value){return $value * 2;},[1,2,3])
map $_ *2, 1,2,3
map(lambda n: n*2, [1,2,3])
[1,2,3].map { |n| n*2 }
List(1,2,3).map(_*2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment