Skip to content

Instantly share code, notes, and snippets.

View KeenS's full-sized avatar

κeen KeenS

View GitHub Profile
(defun bar (n)
(declare (ignore n)))
(defun foo (n)
(if (zerop n)
(print "foo")
(bar (1- n))))
(setf (symbol-function 'bar) (lambda (n)
(if (zerop n)
(print "bar")
fizzbuzz(N, R) :-
fizzbuzz_(N, R);
fizz_(N, R);
buzz_(N, R);
N = R.
fizz_(N, R) :-
0 is N mod 3,
R = fizz.
#!/bin/sh
parents() {
dir="$1"
while [ "${dir}" != "/" ]; do
echo "${dir}"
dir="$(dirname "${dir}")"
done
}

場所

load_piclibでSRFI17を読む時に問題が発生します。

(prefix (only (scheme base) set!) %)を処理する時にプリフィックスとして %を結合します。 結合の時にopen_output_stringを呼びます。それは内部でstring_open(pic, NULL, 0)を呼びますが 第二引数(data)にNULLを渡しているにも関らずif (data != NULL) がthen clauseに飛びます。

load_piclib.c:1882
 pic_load_cstr(pic, &piclib_src_contrib_10_srfi_srfi_17[0][0]);
'mark.txt' loaded. (Length: 20045118 bytes)
<tr><td class="pattern">Twain</td><td class="time">100 ms</td></tr>
<tr><td class="pattern">^Twain</td><td class="time">99 ms</td></tr>
<tr><td class="pattern">Twain$</td><td class="time">100 ms</td></tr>
<tr><td class="pattern">Huck[a-zA-Z]+|Finn[a-zA-Z]+</td><td class="time">246 ms</td></tr>
<tr><td class="pattern">a[^x]{20}b</td><td class="time">2182 ms</td></tr>
<tr><td class="pattern">Tom|Sawyer|Huckleberry|Finn</td><td class="time">288 ms</td></tr>
<tr><td class="pattern">.{0,3}(Tom|Sawyer|Huckleberry|Finn)</td><td class="time">847 ms</td></tr>
<tr><td class="pattern">[a-zA-Z]+ing</td><td class="time">6278 ms</td></tr>
<tr><td class="pattern">^[a-zA-Z]{0,4}ing[^a-zA-Z]</td><td class="time">203 ms</td></tr>
###
### keymap.conf
###
# ======================================================================
# event section
# ======================================================================
SKK_JMODE keycode::0x68
SKK_ENTER group::hex::0x03,0x0a,0x0d||ctrl::m
_require "basis.smi"
structure Benchmark =
struct
val repeat: int ->(unit -> 'a) -> unit
val bench: int -> (unit -> 'a) -> LargeInt.int
val benchmark: string -> int -> (unit -> 'a) -> unit
end
structure Re =
struct
datatype t
= Item of char
| Or of t * t
| And of t * t
| Kleene of t
| Any
| Empty
(define-library (pattern-match-lambda)
(import (scheme base))
(define-syntax if-identifier
(syntax-rules ()
((_ condition seq alt)
(let-syntax ((foo (syntax-rules () ((_) seq))))
(let-syntax ((test (syntax-rules ()
((_ condition) (foo))
((_ foo) alt))))
(test foo))))))
Script started on Fri Jan 23 08:31:06 2015
%
(:branch master :cwd ~/compile/rust)../cond figure --enable clang     -clang
configure: looking for configure programs
configure: found cmp
configure: found mkdir
configure: found printf