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
#| | |
Calculate levenshtein distance network. | |
|# | |
(defvar *distance* 1) | |
(defun levenshtein-distance (word1 word2) | |
(declare (optimize (safety 0) (speed 3) (debug 0)) | |
(type simple-string word1 word2)) | |
(flet ((make-table (word1 word2) | |
(declare (optimize (safety 0) (speed 3) (debug 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
(library (partcont) | |
(export shift reset) | |
(import (rnrs) (srfi :39)) | |
(define *meta-continuation* | |
(make-parameter | |
(lambda value | |
(error "No top-level RESET" value)))) | |
(define-syntax reset | |
(syntax-rules () |
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
#!r6rs | |
(import (rnrs)) | |
(define (port-fold proc seed reader) | |
(let loop ((e (reader)) (seed seed)) | |
(if (eof-object? e) | |
seed | |
(loop (reader) (proc e seed))))) | |
(define (parse-line port) |
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
#!r6rs | |
(import (only (rename (rnrs) (cons %cons) (+ %+)) | |
define lambda let display newline integer->char length | |
quote %cons)) | |
(define cons (lambda (x y) (lambda (z) (z x y)))) | |
(define car (lambda (z) (z (lambda (x y) x)))) | |
(define cdr (lambda (z) (z (lambda (x y) y)))) | |
(define true (lambda (x y) (x))) |
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
(import (rfc http) (rfc base64)) | |
(define (auth-handler hdrs) | |
(print hdrs) | |
(let ((msg "hoge:fuga")) | |
;; need to return a list of header and value | |
`(("authorization" ,(format "Basic ~a" | |
(utf8->string | |
(base64-encode (string->utf8 msg)))))))) | |
(let-values (((code hdr body) |
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
#!r6rs | |
(import (rnrs)) | |
(begin | |
#!compatible | |
(call-with-input-file "test.scm" | |
(lambda (p) (print (get-bytevector-all p))) | |
:transcoder #f) | |
#!r6rs | |
(print (keyword? :key)) ;; error unbound variable | |
) |
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
(library (string) | |
(export :export-reader-macro) | |
(import (rnrs) | |
(srfi :6 basic-string-ports) | |
(sagittarius) | |
(sagittarius reader) | |
(sagittarius control) | |
(text parse)) | |
;; the result will be (string-concatenate (list of string and symbol)) |
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
$ sash etc/tak-sash.scm | |
0.62803584 | |
$ ./bin/picrin.exe etc/tak.scm | |
1.404000 | |
$ gosh etc/tak-gosh.scm | |
;(time (f)) | |
; real 0.734 | |
; user 0.734 |
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
CC=gcc | |
CFLAGS=-Wall -O3 | |
UNAME_S := $(shell uname -s) | |
SO_PREFIX=lib | |
SO_EXT=.so | |
ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN) | |
SO_PREFIX=cyg | |
SO_EXT=.dll | |
endif |
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
~/work/picrin$ sash etc/tak-sash.scm | |
env LD_LIBRARY_PATH=lib bin/picrin etc/tak.scm | |
0.830000 | |
~/work/picrin$ sash etc/tak-sash.scm | |
0.462195968 |
OlderNewer