The at-exp racket includes curly braces

How can I use at-exp to include a nested source line:

package foo

}

import (

      

I write like this, but cannot include the "}" character:

#lang at-exp racket/base

    (define code @S{
        package foo

        }

        import (
    }

      

How to include a special character like "{}" in the original part.

+3


source to share


2 answers


Use @S|{...}|

for this: since the covering part }|

, plain }

won't be special. Also, remember to use |@

instead @

for nested forms. And if you need a different quote as you want to use }|

too, you can add more things in between, as in @S|==={...}===|

. For more details see page (see |{

s and see section 2.4.1 ).



What you found: They are not the same. What you are doing is there is a nested string "{"

that you can use for each unbalanced character. But this is much less convenient than the alternative quote syntax above.

+5


source


Oh sorry, I found use @ | "{" | fine.



+1


source







All Articles