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
import sys | |
from asyncio import coroutine, sleep | |
from aiohttp import web | |
@coroutine | |
def handle(request): | |
seconds = float(request.match_info.get('seconds', 1)) | |
yield from sleep(seconds) | |
text = "You've been waiting for {} seconds".format(seconds) | |
return web.Response(body=text.encode('utf-8')) |
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
; pen test on functional programming | |
(define (min-2 a b) (if (> a b) b a)) | |
(define (min-3 a b c) (min-2 (min-2 a b) (min-2 b c))) | |
(define (sq x) (* x x)) | |
(define (foo a b c) (cond ((= a (min-3 a b c)) (+ (sq b) (sq c))) | |
((= b (min-3 a b c)) (+ (sq a) (sq c))) | |
(else (+ (sq a) (sq b))))) |
NewerOlder