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
;;==============Tiny framework of Actor-model========================= | |
(use-modules (ice-9 control) (ice-9 match) (ice-9 q)) | |
(define *mailbox* (make-hash-table)) | |
(define *task-queue* (make-q)) | |
(define (gen-pid n) (gensym (format #f "actor-~a-" n))) | |
(define-syntax-rule (! pid msg) | |
(let ((mq (hashq-ref *mailbox* pid))) | |
(if mq |
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
(use-modules (artanis server epoll) | |
(artanis utils) | |
(ice-9 rdelim) | |
(ice-9 match) | |
(ice-9 suspendable-ports) | |
(ice-9 control)) | |
(install-suspendable-ports!) | |
(define (call-with-sigint x y) (%call-with-sigint x y)) |
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
(define (make-lru size) | |
(define cnt 0) | |
(define fl '()) | |
(define ht (make-hash-table)) | |
(define (refresh-fl i) | |
(set! fl (cons i (filter (lambda (x) (not (= x i))) fl)))) | |
(lambda (cmd . i/v) | |
(case cmd | |
((get) | |
(refresh-fl (car i/v)) |
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
#!/usr/bin/env guile | |
!# | |
(use-modules (ice-9 rdelim) | |
(ice-9 ftw) | |
(ice-9 futures) | |
(srfi srfi-1)) | |
(define get-string-all (@ (rnrs io ports) get-string-all)) | |
(define G (ash 1 30)) | |
(define M (ash 1 20)) |
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
cat test.c | |
------------------------------------------------------------ | |
int main(int argc, char * argv[]) { | |
__asm__ ("call __foo_bar_%P0" : : "i"(42)); | |
return 0; | |
} | |
------------------------------------------------------------ | |
gcc -S test.c | |
cat test.s |
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
#!/bin/bash | |
while read -e input | |
do | |
for i in $input | |
do | |
play -q -n synth 3 pluck %$(expr index abbccddeeffgg $i - 1) & | |
sleep 0.5 | |
done | |
done |
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
(for-each (lambda (s) | |
(let ((p (module-ref (current-module) s))) | |
(if (procedure? p) | |
(format #t "[~a]~%~@[~a~%~]" p (procedure-documentation p))))) | |
(apropos-internal ".*")) |
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
(use-modules (srfi srfi-1) (ice-9 control)) | |
(define (either . args) (shift k (for-each k args))) | |
(define (sq x) (* x x)) | |
(define (choice from to) | |
(reset (let ((ll (iota to from))) | |
(let ((x (apply either ll))(y (apply either ll))(z (apply either ll))) | |
(if (= (sq z) (+ (sq x) (sq y))) | |
(format #t "~a^2 + ~a^2 = ~a^2~%" x y z)))))) |
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
diff --git a/test-suite/tests/web-client.test b/test-suite/tests/web-client.test | |
index 3133b73..6038398 100644 | |
--- a/test-suite/tests/web-client.test | |
+++ b/test-suite/tests/web-client.test | |
@@ -299,13 +299,28 @@ Content-Language: en | |
") | |
;; Unfortunately, POST to http://www.gnu.org/software/guile/ succeeds! | |
+(define post-request-headers-null:www.apache.org/ | |
+ "POST / HTTP/1.1 |
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
(define-module (test-suite web-client) | |
#:use-module (web client) | |
#:use-module (web request) | |
#:use-module (web response) | |
#:use-module (ice-9 iconv) | |
#:use-module (ice-9 binary-ports) | |
#:use-module (test-suite lib)) | |
(define get-request-headers:www.gnu.org/software/guile/ |
NewerOlder