lib/srfi/srfi-0.scm: add.
This commit is contained in:
parent
b63444d919
commit
502336bf30
10
lib/srfi/srfi-0.scm
Normal file
10
lib/srfi/srfi-0.scm
Normal file
|
@ -0,0 +1,10 @@
|
|||
(define mes '(0 1))
|
||||
|
||||
(define (cond-expand-expander clauses)
|
||||
(let loop ((clauses clauses))
|
||||
(if (defined? (caar clauses))
|
||||
(eval (cons 'begin (cdar clauses)) (current-module))
|
||||
(loop (cdr clauses)))))
|
||||
|
||||
(define-macro (cond-expand . clauses)
|
||||
`(cond-expand-expander (quote ,clauses)))
|
6
scm.mes
6
scm.mes
|
@ -98,8 +98,8 @@
|
|||
(define (apply f args)
|
||||
(eval (cons f args) (current-module)))
|
||||
|
||||
(define (defined? x)
|
||||
(assq x (current-module)))
|
||||
(define-macro (defined? x)
|
||||
`(assq ,x (cddr (current-module))))
|
||||
|
||||
(define (procedure? p)
|
||||
(cond ((builtin? p) #t)
|
||||
|
@ -199,8 +199,6 @@
|
|||
(set! counter (+ counter 1))
|
||||
(string->symbol (string-append "g" value))))))
|
||||
|
||||
|
||||
()
|
||||
;; srfi-1
|
||||
(define (last-pair lst)
|
||||
(let loop ((lst lst))
|
||||
|
|
5
test.mes
5
test.mes
|
@ -32,7 +32,8 @@
|
|||
((car t) (display ": pass") (newline) (set! pass (+ pass 1)))
|
||||
(#t (display ": fail") (newline) (set! fail (+ fail 1)))))))
|
||||
|
||||
(define (guile?) (defined? 'gc))
|
||||
;;(define (guile?) (defined? 'gc))
|
||||
(define (guile?) #f)
|
||||
(when (guile?)
|
||||
(module-define! (current-module) 'builtin? (lambda (. x) #t))
|
||||
(use-modules (srfi srfi-1)))
|
||||
|
@ -234,6 +235,8 @@
|
|||
;; (circular-list? x))
|
||||
;; #t))
|
||||
|
||||
(pass-if "cond-expand" (sequal? (cond-expand (foobar #f) (mes (display ": pass: *YAY*") 'mes)) 'mes))
|
||||
|
||||
(newline)
|
||||
(display "passed: ") (display (car (result))) (newline)
|
||||
(display "failed: ") (display (cadr (result))) (newline)
|
||||
|
|
Loading…
Reference in a new issue