[CM] S7, float to string conversion

James Hearon j_hearon at hotmail.com
Fri Jan 3 16:25:36 PST 2014


Hi,
Yes.  all of those will work to convert float to string for output to file.  There is probably a better way of writing CM pattern float output to a file as strings than my example, but at least this gets me going again.  

Regards,
Jim


(number->string 123)
(object->string 123.45)
(format #f "~G" 123)
(format #f "~f" 123.456)


> (define ouf1 (open-output-file "myfloats.txt"))
> (define outstring "init")
>  
> (define (myfloats total)
> (let ((test 0))
>  (process  with mytable = (make-heap '(.5 1 2.5 3))
>       until (= test total)
>       do
> (set! outstring (next mytable))   ;***stuck here with format conversion ***
> (set! outstring (string-append outstring (string #\newline)))
> (display outstring ouf1)
> (print (next mytable))
> (set! test (+ test 1))  
> )))
>  
> (sprout (myfloats 10) )
>  
> (close-output-port ouf1)

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ccrma-mail.stanford.edu/mailman/private/cmdist/attachments/20140104/77169c8e/attachment.html 


More information about the Cmdist mailing list