On my 4.0 beta 21 installation (compiled with single-host and shared), this doesn't segfault:
(define (string-escape string chars #!optional (escape (lambda (c) (print #\ c))) port) (let ((pred? (%string-charset->pred chars)) (output (or port (open-output-string "")))) (with-output-to-port output (& (string-for-each ;; <--from srfi-13 (lambda (c) (if (pred? c) (escape c) (print c))) ; this is where the anti-magic happens string))) (or port (get-output-string output))))
Note that I did change it at two locations: - with-output-port is not present in beta 21 (neither did I find it in the manual of beta 22), so I did change to with-output-to-port - with-output-to-port expect a thunk as second argument, so I did wrap it in (& ) where this is a macro defined by myself (I deserve the right to use my own code too, now :^)):
(define-macro (& first . rest) `(lambda() ,first ,@rest))
Christian.