Skip to content

Instantly share code, notes, and snippets.

View letoh's full-sized avatar
💭
I may be slow to respond.

letoh letoh

💭
I may be slow to respond.
View GitHub Profile
// 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[], ...) {
@letoh
letoh / fizzBuzz.c
Last active February 14, 2017 06:08 — forked from lancetw/fizzBuzz.c
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;
@letoh
letoh / interpreter.js
Created June 19, 2017 07:51 — forked from be5invis/interpreter.js
A CPS-style S-exp interpreter (with call/cc)
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];