This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-02
Channels
- # beginners (23)
- # calva (12)
- # cider (4)
- # clj-kondo (4)
- # cljsrn (2)
- # clojure (25)
- # clojure-chicago (1)
- # clojure-italy (6)
- # clojurescript (5)
- # datomic (5)
- # flambo (1)
- # fulcro (16)
- # hoplon (5)
- # joker (2)
- # keechma (45)
- # off-topic (2)
- # pedestal (2)
- # rewrite-clj (13)
- # robots (5)
- # shadow-cljs (62)
- # xtdb (12)
How would I quote the symbol /=
? '=
is fine, '/
is fine, but /=
says unmatched delimiter: )
. Do I need to escape the slash or something?
[dan@fedora datascript-todo]$ clj
Clojure 1.9.0
user=> (quote \=)
\=
user=> '\=
\=
i'm guessing this is an issue with your repl?That's backslash, I was trying with forward slash
> /' has special meaning, it can be used once in the middle of a symbol to separate the namespace from the name, e.g. my-namespace/foo. '/' by itself names the division function.
yeah even this doesn't work: (read-string "/=")
=> invalid token: /=
so i'm making a toy library for array syntax to learn macros
and was trying to support e.g. a[0][1] /= 2
but I can't define a symbol /=
to recognize
yeah just not sure how to work around it
I guess I'd have to recognize it as a string
like turn the list body into a string and parse it
I think I could turn the body into a string and find /=
in the string and handle it accordingly
but it would probably mean I'd have to do all the other cases (e.g. *=
the same way) 😕
If you are trying to "write a language" with Clojure macros that has the full library of Clojure available as well, then I'd recommend using a different symbol than /=
, e.g. div=
, even if that looks ugly.
If you are trying to write a language with its own custom syntax, and you are writing a compiler in Clojure to translate it into some other language that isn't Clojure, then you should be able to define whatever syntax you want that you can write a parser for. I am guessing that is not what you are trying to do, though.