This file contains hidden or 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
(defun sum (term a next b) | |
(if (> a b) | |
0 | |
(+ (funcall term a) | |
(sum term (funcall next a) next b)))) | |
(defun cube (x) (* x x x)) | |
(defun integral (f a b dx) | |
(defun add-dx (x) (+ x dx)) | |
(* (sum f | |
(+ a (/ dx 2.0)) |
This file contains hidden or 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
(defun cube (x) (* x x x)) | |
(defun sum-iter (term a next b) | |
(defun iter (a result) | |
(if (> a b) | |
result | |
(iter (funcall next a) (+ result (funcall term a))))) | |
(iter a 0)) | |
(defun simp-integral (f a b n) |
This file contains hidden or 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
(defun product (term a next b) | |
(if (> a b) | |
1 | |
(* (funcall term a) | |
(product term (funcall next a) next b)))) | |
(defun product-iter (term a next b) | |
(defun iter (a result) | |
(if (> a b) | |
result |
This file contains hidden or 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
(defun accumulate (combiner null-value term a next b) | |
(if (> a b) | |
null-value | |
(funcall combiner | |
(funcall term a) | |
(accumulate combiner null-value term (funcall next a) next b))) | |
) | |
(defun accumulate-iter (combiner null-value term a next b) | |
(defun iter (a result) | |
(if (> a b) |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import socket | |
import select | |
if __name__ == '__main__': | |
addr = ('127.0.0.1', 8004) | |
epoll = select.epoll() | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect(addr) | |
s.setblocking(0) |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import socket | |
import select | |
if __name__ == '__main__': | |
addr = ('127.0.0.1', 8004) | |
max_sockets = 3 | |
max_requests = 100 | |
request_cnt = 0 | |
sockets = {} |
This file contains hidden or 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
if isinstance(c_content, (str, unicode)): | |
uc = c_content.encode('utf8') | |
cnt['content'] = json.loads(uc) |
This file contains hidden or 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
<?php | |
function test_foreach(&$tgt) | |
{ | |
foreach ($tgt as &$_t) | |
{ | |
$_t['v'] = $_t['v'] + 1; | |
} | |
foreach ($tgt as $_t) |
This file contains hidden or 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
{ | |
"result": { | |
"err_no": 0 | |
}, | |
"content": [ | |
{ | |
"type": "log", | |
"content": { | |
"enable": 1, | |
"size": 3072 |
This file contains hidden or 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
.big-wrapper | |
.notice | |
pre | |
code vertical-align: middle | |
br | |
| for IE 7+ | |
style | |
:stylus | |
.big-wrapper |