[CM] Fomus and saving a string into a file

Torsten Anders torsten.anders at beds.ac.uk
Mon May 2 09:47:04 PDT 2011


Dear Rick,

Thank you for your quick response. 

> hmmm Fomus menu should definitely be there

Oops, fomus was indeed not installed (swapped laptops recently). Apology for this confusion.

> ok in scheme you can do something like this:

The Scheme code works fine for me, thank you!  I could not find with-output-to-file in the documentation of s7, and I missed the remark "Although it is a descendant of tinyScheme, s7 is closest as a Scheme dialect to Guile 1.8. I believe it is compatible with r5rs". For the record, I rewrote your macro to the following.

(define-macro (format-to-file file . args)
 `(with-output-to-file ,file
    (lambda ()
      (format #t ,(first args) ,@(rest args)))))
;; test
; (format-to-file "test.txt" "my magic number is ~S~%" (random 1000))

Best wishes,
Torsten

On 2 May 2011, at 16:38, Heinrich Taube wrote:

> hi torsten, nice to hear from you!
> 
>> - It appears Fomus is not working, and I could not find menu entry for configuring it.
> 
> 
> hmmm Fomus menu should definitely be there (in the Audio menu)  if you are using the binary version of Grace and if you have fomus framework installed. i know you are on the fomus list so im assuming that you have fomus installed.
> 
> If you built Grace from sources then fomus will only be there if you specified  '--fomus /usr/local/'  option to the premake. for example, this is what I type to compile things on my mac:
> 
> 	$ premake --verbose --target gnu --sndlib ../sndlib --liblo ../liblo-0.26/ --fomus /usr/local
> 	$ make
> 
> if things work you will see Fomus listed in the herald when the console window opens, for ecample this is what I see as the first few lines in the Console  (Im using my developer sources so the version might be different that what you see:
> 
> 	Grace 3.8.0 [svn:1933:1934M] (c) 2011 Rick Taube
> 	JUCE v1.52.110 (c) 2011 Julian Storer
> 	S7 Scheme 1.83 (14-Mar-11) (c) 2011 William Schottstaedt
> 	FOMUS 0.1.17-alpha (c) 2011 David Psenicka
> 	[...]
> 
>> - Is it perhaps possible to save a string into a text file. (I realise that I could print into the console and then copy/paste from there, though.)
> 
> 
> ok in scheme you can do something like this:
> 
> (with-output-to-file "hiho.text"
>  (lambda ()
>    (format #t "hiho!~%" )
>    (format #t "my magic number is ~S~%" (random 1000) )))
> 
> 
> or if you do this a lot you could define a  helper macro like this:
> 
> (define-macro (dribble file . args)
>  `(with-output-to-file ,file
>     (lambda ()
>       , at args
>       ,file)))
> 
> (dribble "hiho2.text"
>  (format #t "hiho2!~%" )
>  (format #t "my other magic number is ~S~%" (random 1000) )
>  )
> 
> 




More information about the Cmdist mailing list