Skip to content

Instantly share code, notes, and snippets.

@yamasushi
yamasushi / test.log
Created October 1, 2012 05:03
test log
Testing VM stack sanity... ====================================================
simple expression ... ok
with-error-handler (1) ... ok
with-error-handler (2) ... ok
with-error-handler (3) ... ok
passed.
Testing integer arithmetic macros ... =========================================
<UADD>-------------------------------------------------------------------------
testing 4294967295+0 c=0 expects r=4294967295, c=0 =>ok
testing 4294967295+1 c=0 expects r=0, c=1 =>ok
(define (make-string q)
(let* ([%quote ($char q)]
[%escape ($char #\\)]
[%hex4 ($fmap (^s (string->number (list->string s) 16))
($many hexdigit 4 4))]
[%special-char
($do %escape
($or ($char q)
($char #\\)
($char #\/)
; リソースID(uriなど)が指すデータを読んで、アイテムリストに変換する手続きを返す。
; アイテム、ヘッダを多値で返す。(ヘッダはないときもあるのでアイテム優先の順序)
(define (read-and-map$
:key
get-raw ; id ---> res 元データを読む生データを返す
raw->items ; res ---> items 生データからアイテムリストに変換
(raw->header (^x #f) ) ; res ---> header 生データからヘッダ抽出 ... 省略可
(item-map #f ) ; 各アイテムを変換
(item-filter #f ) ; 変換後のフィルタ
(peek-id (^x ) ) ; idを覗く
(use gauche.lazy)
(define (tee$ outfn)
(^ arg
(apply outfn arg) ;; xを分岐出力
(apply values arg) ;; xをそのまま返す
))
(define (tee-format-stderr$ fmt)
(tee$ ($ format (standard-error-port) fmt $) ) )
(use util.stream)
(define (tee$ outfn)
(^ arg
(apply outfn arg) ;; xを分岐出力
(apply values arg) ;; xをそのまま返す
))
(define (tee-format-stderr$ fmt)
(tee$ ($ format (standard-error-port) fmt $) ) )
(use gauche.generator)
(define (tee$ outfn)
(^ arg
(apply outfn arg) ;; xを分岐出力
(apply values arg) ;; xをそのまま返す
))
(define (tee-format-stderr$ fmt)
(tee$ ($ format (standard-error-port) fmt $) ) )
;------------------------------------------
;%seq%generator.scm
(define-module %seq%generator (extend gauche.generator)
(export
%seq%null
%seq%concatenate
%seq%map
%seq%filter
%seq%unfold
; 生データの列から読んで、アイテム列に変換する手続きを返す。
; アイテムを返す。
; [S]->(S->[I])->(I->I)->(I->bool)-> [I]
; (I->I) でアイテムの変換 (省略可、省略時はなにもしない)
; (I->bool)でフィルタする (省略可、省略時はなにもしない)
(define (%seq%-read-and-map$
%seq%-map %seq%-filter %seq%-concatenate x->%seq%
:key
raw->items ; res ---> items 生データからアイテムリストに変換
(item-map #f ) ; 各アイテムを変換
; 小物モジュール(基本)
(define-module komono-base
(use srfi-1) ; list
(use srfi-13) ; string
(use util.stream)
(use gauche.collection)
;
(export
nop ; なにもしない。
make-alist ; 連想リストを生成する。
; if-sxpath , if-car-sxpath が名前空間を渡せないので作った補助
(define-module sxpath-helper (extend sxml.sxpath)
(use komono-base)
(export if-car-sxpath if-sxpath )
)
(select-module sxpath-helper)
(define (if-sxpath xpath :optional (ns '()))
(if-listfn$ (sxpath xpath ns) ) )