PasteRack.org
Paste # 15618
2016-07-26 11:45:53

Forked from paste # 3379.

Fork as a new paste.

Paste viewed 373 times.


Embed:

macro generated set!

  1. ;there is no built-in way to set! append in racket
  2. (define mystr "foo")
  3. (set! mystr (string-append mystr " bar"))
  4. (displayln mystr)
  5.  
  6. ;but you can create a quick macro to solve that problem
  7. (define-syntax-rule (set-append! str value)
  8.   (set! str (string-append str value)))
  9.  
  10. (define mymacrostr "foo")
  11. (set-append! mymacrostr " bar")
  12. (displayln mymacrostr)

=>

load-handler: expected a `module' declaration for `pasterack' in "paste 15618", but found something else

Check that paste includes #lang?