Skip to content

Instantly share code, notes, and snippets.

@bradwright
Created April 10, 2009 09:22
Show Gist options
  • Save bradwright/93016 to your computer and use it in GitHub Desktop.
Save bradwright/93016 to your computer and use it in GitHub Desktop.
-module(my_calc).
-export([my_calc/2]).
%% My Erlang representation of:
%% http://math.andrej.com/2009/04/09/pythons-lambda-is-broken/
my_calc([], _) ->
[];
my_calc(L, N) ->
[H + N || H <- L].
%% 1> L = lists:seq(0,9).
%% 2> c(my_calc).
%% 3> my_calc:my_calc(L, 4).
%% [4,5,6,7,8,9,10,11,12,13]
%% 4> victory.
%% victory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment