Skip to content

Instantly share code, notes, and snippets.

View shirok's full-sized avatar

Shiro Kawai shirok

View GitHub Profile
;; -*- coding: utf-8 -*-
#!c-expr
;; I always use Scheme as a quick calculators, and a few such expressions
;; happened to be in my scratch buffer so I turned it to C-exprs.
(use srfi-42)
(define ^^ expt)
(use srfi-60) ; for list->integer
(define read-bools
($ gconcatenate $ gmap (cut reverse-bits->generator <> 0 8)
$ port->byte-generator $))
(define (string->bools s) (call-with-input-string s read-bools))
(define (write-bools src)
($ generator-for-each (^b (write-byte (list->integer b)) (flush))
$ gslices src 8 #t 0))
;;
;; Implementation of John Nash's enciphering-deciphering machine described in
;; http://www.nsa.gov/public_info/_files/nash_letters/nash_letters1.pdf
;;
(use gauche.sequence)
(use gauche.generator)
(use srfi-43)
;; The 'key' of this machine is a configuration of Permuter-Reverser (P/R)
(use gauche.lazy)
(use util.match)
(define-syntax define*
(syntax-rules ()
[(_ (fn . pats) . body) (define fn (match-lambda* [pats . body]))]))
(define (stream next safe prod kons seed xs)
(^[] (let loop ([y (next seed)])
(cond [(safe seed y) (set! seed (prod seed y)) y]
module Main where
import Ratio
stream :: (b->c) -> (b->c->Bool) -> (b->c->b) -> (b->a->b) -> b -> [a] -> [c]
stream next safe prod cons z (x:xs)
= if safe z y
then y : stream next safe prod cons (prod z y) (x:xs)
else stream next safe prod cons (cons z x) xs
where y = next z
diff --git a/ext/peg/peg.scm b/ext/peg/peg.scm
index dec9d65..dd968d8 100644
--- a/ext/peg/peg.scm
+++ b/ext/peg/peg.scm
@@ -246,12 +246,13 @@
(define (peg-parser->generator parser src)
(let1 s (%->lseq src)
(generate (^[yield]
- (let loop ([s s])
+ (let loop ()
diff --git a/src/Makefile.in b/src/Makefile.in
index 7b74d53..5ab5b9e 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -415,12 +415,20 @@ INSTALL_DIRS = $(DESTDIR)$(HEADER_INSTALL_DIR) \
@CROSS_COMPILING_no@GAUCHE_INSTALL = ./gosh -ftest $(srcdir)/gauche-install.in
@CROSS_COMPILING_yes@GAUCHE_INSTALL = gosh $(srcdir)/gauche-install.in
-install : all install-dirs install-aux install-core
+install : install-core
diff --git a/ChangeLog b/ChangeLog
index 6b06cc3..344d74f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-31 Shiro Kawai <[email protected]>
+
+ * ext/threads/thread.c (Scm_ThreadTerminate): Fixed SEGV bug when
+ thread-terminate! is called on a thread that's not running.
+
diff --git a/src/Makefile.in b/src/Makefile.in
index 7b74d53..90507ff 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -420,7 +420,7 @@ install : all install-dirs install-aux install-core
install-dirs :
$(MKINSTDIR) $(INSTALL_DIRS)
-install-core : relink
+install-core : all install-dirs install-aux relink
diff --git a/lib/gauche/test.scm b/lib/gauche/test.scm
index ab34e40..af082ad 100644
--- a/lib/gauche/test.scm
+++ b/lib/gauche/test.scm
@@ -361,6 +361,10 @@
[proc (global-variable-ref
(slot-ref gref 'module)
(slot-ref gref 'name))]
+ ;; We exclude <generic> with no methods. Such "placeholder"
+ ;; generic function may be used in the base module, expecting