This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function interpret(form, env, k){ | |
if(form instanceof Array){ | |
switch(form[0]){ | |
case 'lambda': { | |
var params = form[1]; | |
var body = form[2]; | |
return k(function(k){ return function() { | |
var e = Object.create(env); | |
for(var j = 0; j < params.length; j++) | |
e[params[j]] = arguments[j]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char** fizzBuzz(int n, int* returnSize) { | |
struct _ { | |
char *rets[n + 1]; | |
char data[0]; | |
} * ret = calloc(sizeof(struct _) + n * 9 + 1, sizeof(char)); | |
*returnSize = n; | |
char * sp = ret->data; | |
for (int i = 1; i <= n; ++i, sp += 9) { | |
ret->rets[i - 1] = sp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// modified from b****'s implementation https://gist.github.com/anonymous/aaafa4bd4de9d1a8ffa0 | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdarg.h> | |
enum {n, y, d, o, r, e, m, s, _}; | |
int to_num(char hash[], ...) { |