Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Translating "((if (> b 0) + -) a b))" from lisp into C#
static readonly Func<int, int, int> add = (int x, int y) => x + y;
static readonly Func<int, int, int> subtract = (int x, int y) => x - y;
public static int a_plus_abs_b(int a, int b)
{
return ((b > 0) ? add : subtract)(a, b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.