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
(use-modules (ice-9 rdelim))(define morse '((#\a ".-")(#\b "-...")(#\c "-.-.")(#\d "-..")(#\e ".")(#\f "..-.")(#\g "--.")(#\h "....")(#\i "..")(#\j ".---")(#\k "-.-")(#\l ".-..")(#\m "--")(\ | |
#\n "-.")(#\o "---")(#\p ".--.")(#\q "--.-")(#\r ".-.")(#\s "...")(#\t "-")(#\u "..-")(#\v "...-")(#\w ".--")(#\x "-.--")(#\y "-.--")(#\z "--..")))(for-each (lambda (x) (if (char-alphabetic\ | |
? x)(display (car (assoc-ref morse x))))(display " "))(string->list (string-downcase (read-line (current-input-port)))))(newline) |
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
#!/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 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
;;==============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 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
(use-modules (ice-9 match)) | |
(define (cl str) | |
(define (parser s) | |
(let lp((i 0) (ret '())) | |
(cond | |
((= i (string-length s)) | |
(map (lambda (x) | |
(if (char? x) (string->symbol (string x)) x)) | |
(reverse ret))) |
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
(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 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
(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)) |
OlderNewer