diff --git a/test2.scm b/test2.scm index 76b42bf9..90ec41fb 100644 --- a/test2.scm +++ b/test2.scm @@ -15,10 +15,26 @@ ; (display 'world))) ; BEGIN test code - trying to get definition of with-output-to-file to work -(define old (current-output-port)) -(define new (current-output-port ' (open-output-file "test.txt"))) + (define (my-make-parameter init . o) + (let* ((converter + (if (pair? o) (car o) (lambda (x) x))) + (value (converter init))) + (lambda args + (cond + ((null? args) + value) + ((eq? (car args) ') + (set! value (cadr args))) + ((eq? (car args) ') + converter) + (else + (error "bad parameter syntax")))))) + (define my-param + (my-make-parameter (Cyc-stdout))) +(define old (my-param)) +(define new (my-param ' (open-output-file "test.txt"))) ; The next line seems to crash in icyc but not in compiled code (until write, at least). what's going on?? -(current-output-port ' new) -;(write 'test (current-output-port)) +(my-param ' new) +(write 'test (my-param)) ;(write 'hello-world) ; END test code