Welcome to the CHICKEN Scheme pasting service
trivial z3 usage example pasted by siiky on Thu Dec 7 16:19:53 2023
(import (chicken io) (chicken port) z3) (with-output-to-port (z3:open-compressed-output-file "hello.gz") (lambda () (print "hello"))) (with-input-from-port (z3:open-compressed-input-file "hello.gz") (lambda () (print (read-line))))
z3 usage example (w/o with-*-port) pasted by siiky on Thu Dec 7 16:32:45 2023
(import (chicken io) (chicken port) z3) (let ((port (z3:open-compressed-output-file "hello.gz"))) (write-line "hello" port) (close-output-port port)) (let ((port (z3:open-compressed-input-file "hello.gz"))) (print (read-line port)) (close-input-port port))
Output of both examples added by siiky on Thu Dec 7 16:34:49 2023
# Using with-*-port $ csi -s gz.scm Error: (z3:read-decoded) can not read encoded data - Bad message Call history: <syntax> (##core#begin (print "hello")) gz.scm:3 (print "hello") gz.scm:2 (with-output-to-port (z3:open-compressed-output-file "hello.gz") (lambda () (print "hello"))) gz.scm:2 (z3:open-compressed-output-file "hello.gz") gz.scm:3 (print "hello") gz.scm:4 (with-input-from-port (z3:open-compressed-input-file "hello.gz") (lambda () (print (read-line)))) gz.scm:4 (z3:open-compressed-input-file "hello.gz") gz.scm:5 (lambda () (print (read-line))) gz.scm:5 (##core#lambda () (print (read-line))) <syntax> (##core#begin (print (read-line))) gz.scm:5 (print (read-line)) gz.scm:5 (read-line) gz.scm:4 (with-input-from-port (z3:open-compressed-input-file "hello.gz") (lambda () (print (read-line)))) gz.scm:4 (z3:open-compressed-input-file "hello.gz") gz.scm:5 (print (read-line)) gz.scm:5 (read-line) <-- # Without with-*-port $ csi -s gz.scm hello