walter@vlsivie.tuwien.ac.at (03/09/91)
Does anybbody know how to construct a function "list->string" for MIT Scheme vers 7.0 ? It should work as follows: (list->string '((a 1) (b 2))) => "((a 1) (b 2))" I can find many conversion functions like number->string, symbol->string etc. but can't use that for my trivial seeming function. I would appreciate any comments to that problem walt Walter Eder Dept. of VLSI-Design, University Vienna, Austria Email: walter@vlsivie.tuwien.ac.at
arthur@altdorf.ai.mit.EDU ("Arthur Gleckler") (03/11/91)
Date: 9 Mar 91 09:38:51 GMT From: walter@vlsivie.tuwien.ac.at Organization: Vienna University of Technology, Dept. of VLSI-Design Newsgroups: comp.lang.scheme.c Sender: info-cscheme-request@altdorf.ai.mit.edu Does anybbody know how to construct a function "list->string" for MIT Scheme vers 7.0 ? It should work as follows: (list->string '((a 1) (b 2))) => "((a 1) (b 2))" I can find many conversion functions like number->string, symbol->string etc. but can't use that for my trivial seeming function. I would appreciate any comments to that problem walt Walter Eder Dept. of VLSI-Design, University Vienna, Austria Email: walter@vlsivie.tuwien.ac.at The procedure WITH-OUTPUT-TO-STRING is good for this type of problem. Given a a procedure of no arguments (a "thunk"), it invokes the thunk, capturing all its output in a string. This string is returned as the value of the call to WITH-OUTPUT-TO-STRING: (with-output-to-string (lambda () (display '((a 1) (b 2))))) ;Value 1: "((a 1) (b 2))"
markf@altdorf.ai.mit.EDU (03/11/91)
>> >> Does anybbody know how to construct a function >> "list->string" for MIT Scheme vers 7.0 ? >> It should work as follows: >> >> (list->string '((a 1) (b 2))) >> => "((a 1) (b 2))" >> >> I can find many conversion functions like >> number->string, symbol->string etc. but >> can't use that for my trivial seeming function. (write-to-string '((a 1) (b 2))) ;Value "((a 1) (b 2))" -Mark