Fixing typo in cut implementation.

Fixes issue #241.
This commit is contained in:
Alex Shinn 2014-10-28 07:06:04 +09:00
parent 88506ca53e
commit c4c3cb9eb9
2 changed files with 17 additions and 1 deletions

View file

@ -16,7 +16,7 @@
((%cut #t (params ...) (args ...) x . rest) ((%cut #t (params ...) (args ...) x . rest)
(let ((tmp x)) (%cut #t (params ...) (args ... tmp) . rest))) (let ((tmp x)) (%cut #t (params ...) (args ... tmp) . rest)))
((%cut #f (params ...) (args ...) x . rest) ((%cut #f (params ...) (args ...) x . rest)
(%cut #t (params ...) (args ... x) . rest)))) (%cut #f (params ...) (args ... x) . rest))))
(define-syntax cut (define-syntax cut
(syntax-rules () ((cut args ...) (%cut #f () () args ...)))) (syntax-rules () ((cut args ...) (%cut #f () () args ...))))
(define-syntax cute (define-syntax cute

16
tests/srfi-26-tests.scm Normal file
View file

@ -0,0 +1,16 @@
(import (scheme base) (srfi 26) (chibi test))
(test-begin "srfi-26")
(let ((x 'orig))
(let ((f (cute list x)))
(set! x 'wrong)
(test '(orig) (f))))
(let ((x 'wrong))
(let ((f (cut list x)))
(set! x 'right)
(test '(right) (f))))
(test-end)