Skip to content

Instantly share code, notes, and snippets.

@tiancaiamao
tiancaiamao / ycombinator.rkt
Created December 17, 2014 01:16
y combinator推导
#lang racket
;;定义阶乘函数
(define (fact n)
(if (= n 1)
1
(* n (fact (- n 1)))))
;;由于我们不能使用define,那么把fact作为参数名
(lambda (f)
(lambda (n)
@tiancaiamao
tiancaiamao / accept.c
Created December 9, 2014 06:14
单进程架构
#include <stdio.h>
#include <sys/socket.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
int child(int, int);