Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

racket at-exp include curly bracket

Tags:

racket

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.

like image 605
simmone Avatar asked Apr 16 '26 06:04

simmone


1 Answers

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.

like image 178
Eli Barzilay Avatar answered Apr 19 '26 20:04

Eli Barzilay