5 hours ago, Rodolfo Carvalho wrote: > Good to learn about here strings. I've seen them somewhere but never > paid much attention. > > For short strings I'd rather type things like "\\\\" than > #<<END > \\ > END > > Because the latter is more verbose and breaks the visual flow. > > Both `#<<END' and `END' must come in their own lines, and no line > breaks are considered immediately after and before these tokens, > respectively (reasonable).
Yes, that's the problem with them, in any language. I've mentioned the scribble syntax (which is probably easy to miss since "scribble" gets more strongly associated with "documentation") as a better way to do this. Here's an example: #lang at-exp racket/base (require racket/string) (define rx (λ xs (regexp (string-append* xs)))) (define px (λ xs (pregexp (string-append* xs)))) ;; and now you can use: (define a-digit @px{\d}) (define digit+newline+digit @px{\d \d}) note that the last example is properly indented, but the regexp doesn't have the extra spaces in it. (And BTW, this syntax can do much more than just a convenient replacement for here-strings -- you can also get interpolation to the point of building your own dynamic DSL.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users