simmone
simmone

Reputation: 379

racket at-exp include curly bracket

How can I use at-exp to include blew raw string:

package foo

}

import (

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

#lang at-exp racket/base

    (define code @S{
        package foo

        }

        import (
    }

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

Upvotes: 3

Views: 169

Answers (2)

Eli Barzilay
Eli Barzilay

Reputation: 29546

Use @S|{...}| for that: since the closing part is }|, plain }s would not be special. Also, remember to use |@ instead of just @ for nested forms. And if you need another different quotation since you want to use }|s too, you can add more things between, as in @S|==={...}===|. See the documentation page for details (look for |{s, and see section 2.4.1).

As for what you've found: this is not the same. What you're doing there is a nested "{" string, which you can use for each unbalanced character. But that is much less convenient than the above alternative quotation syntax.

Upvotes: 5

simmone
simmone

Reputation: 379

oh, sorry, I find use @|"{"| is ok.

Upvotes: 1

Related Questions