Skip to content

Instantly share code, notes, and snippets.

@darkf
Created June 6, 2012 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkf/2884961 to your computer and use it in GitHub Desktop.
Save darkf/2884961 to your computer and use it in GitHub Desktop.
Pylike -> JS
struct vec2 (x, y);
def vec2_add(a, b) {
vec2(a.x + b.x, a.y + b.y);
}
def main() {
x = [1, 2, 3];
print("hi! length of x is #{len(x)}");
z = lambda(n) { n*2 };
y = vec2(1, 5);
print(vec2_add(vec2(1, 1), y)); // prints <vec2 x=2 y=6>
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment