Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The core.match example uses python-style triple quotes. Is that actually possible in clojure? I would be enormously excited if it is.


I don't think clojure has triple-quoted strings. Something like

    """
    a
    """
parses as three strings, two of which are empty: "", "\na\n", and "". (Clojure strings are allowed to contain literal newlines.)


Hah, so it is. It was pretty late when I finished this one off, sorry about that.


why? in clojure strings can be multiline already. so there is no point in triple quotes.


So you don't have to escape internal quotes.


Triple quotes tend to come up for two purposes:

1. Long regular expression strings that have quote marks involved. I'm not a fan of large, complex regexes, but a lot of people dislike the line-noise added by escaping.

2. Docstrings that may have quotes in them.

It's to remove the string escaping that makes literals look different from the strings they describe.


Thanks.

Thinking about it, I guess triple-quoted strings also facilitate doctests involving strings that would otherwise be really awkward to read/write.


No, it's not, my bad. Not that there's a need for them, as it turns out.


I tried it at a REPL in version 1.5.1 and it didn't work for me. I don't think standard Clojure has triple-quote strings.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: