Skip to content

Instantly share code, notes, and snippets.

View bmccutchon's full-sized avatar

Brian McCutchon bmccutchon

View GitHub Profile
@bmccutchon
bmccutchon / let-expressions.js
Last active August 7, 2016 18:13
Workaround for the lack of Scheme-style let expressions in JavaScript
/**
* Workaround for the lack of Scheme-style let expressions in JavaScript.
*
* Usage:
* letexp((var1 = <expr1>, var2 = <expr2>, [...] varN = <exprN>) =>
* <body>)
*
* Executes and returns the result of the expression defined in <body>. Said
* expression can make use of the variables defined above (var1, var2, etc.). In
* general, the variables follow the the rules of ECMAScript 6 default function