[plt-scheme] here-string

From: Bruce Hauman (bhauman at cs.wcu.edu)
Date: Sat Mar 6 13:14:08 EST 2004

David J. Neu wrote:

 > Bruce,
 >
 > Thanks for the reply. As Felix mentions, I was hoping for a more
 > WYSIWYG-ish solution where I didn't have to worry about the
 > double-quotes.
 >
 > Either something like the following from the scsh manual:
 >
 > (run (csh -c #<<EOF
 > cd /urops
 > rm -rf *
 > echo All done.
 >
 > EOF
 > ))
 >
 > or even something like the following might be OK (but it's probably
 > not quite as nice):
 >
 > (define sh-code-1
 >   (here-string
 >    alias modemup='su -c "ifdown eth0;wvdial &"'
 >    alias modemdown='su -c "killall wvdial;ifup eth0"'))
 > =>
 > alias modemup='su -c "ifdown eth0;wvdial &"'
 > alias modemdown='su -c "killall wvdial;ifup eth0"'
 >
 > (define sh-code-2
 >   (format    (here-string
 >     alias ~a='su -c "~a"'
 >     alias ~a='su -c "~a"')
 >    "modemup"
 >    "ifdown eth0;wvdial &"
 >    "modemdown"
 >    "killall wvdial;ifup eth0"))
 >
 > --David


OK lets look at bar delimited symbols then. I just read about this.

(display
  (symbol->string
'|alias modemup='su -c "ifdown eth0;wvdial &"'
alias modemdown='su -c "killall wvdial;ifup eth0"'|))

=>

alias modemup='su -c "ifdown eth0;wvdial &"'
alias modemdown='su -c "killall wvdial;ifup eth0"'

-- Bruce


Posted on the users mailing list.