|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
#!/usr/bin/guile -s |
|
|
|
|
!# |
|
|
|
|
|
|
|
|
|
;=============== functions with side effects (I/O) ====================== |
|
|
|
|
(use-modules (ice-9 rdelim)) |
|
|
|
|
|
|
|
|
|
(define (read-lines) |
|
|
|
@ -8,17 +9,18 @@ |
|
|
|
|
(if (eof-object? line) '() (cons line (read-lines)))) |
|
|
|
|
(read-line))) |
|
|
|
|
|
|
|
|
|
(define (display-ln value) (list (display value) (display "\n"))) |
|
|
|
|
|
|
|
|
|
(define (assert-eq error-message expected actual) |
|
|
|
|
(if (not (equal? expected actual)) |
|
|
|
|
(list |
|
|
|
|
(display (list error-message (list "expected" expected) (list "actual" actual))) |
|
|
|
|
(display "\n")) |
|
|
|
|
(display-ln (list error-message (list "expected" expected) (list "actual" actual))) |
|
|
|
|
'())) |
|
|
|
|
|
|
|
|
|
(define (tee value) (car (list value (display value) (display "\n")))) |
|
|
|
|
(define (tee value) (car (list value (display-ln value)))) |
|
|
|
|
;=============== end of functions with side effects ====================== |
|
|
|
|
|
|
|
|
|
(define (id value) value) |
|
|
|
|
(define (is-not value) (lambda (x) (not (= x value)))) |
|
|
|
|
(define (is-not value) (lambda (x) (not (equal? x value)))) |
|
|
|
|
(define is-not-empty (lambda (x) (not (null? x)))) |
|
|
|
|
|
|
|
|
|
(define (prepend first-value) (lambda (rest) (cons first-value rest))) |
|
|
|
|