Closed holyjak closed 2 months ago
Thanks for working on this. The symbol restrictions are a pain; particularly because part of the tutorial is singing the praises of Clojure for being more permissive than Wolfram! I'll need to think about replacing these symbols. I guess the official aliases should try to avoid as many errors as possible.
There's something not quite right about that list as datomic uses '$'s all over the place from what I understand. There is a wider problem though.
What about (roughly speaking) using '_' instead of ':' and '<*>' for Dot (because <x|y> is actually another way of writing the inner product of x and y and '*' has connotations of 'product'? It's very annoying that it seems like '|' is being reserved for something else in the future.
So, my take is to use
_= SetDelayed
=! Unset
_> RuleDelayed
<*> Dot
'officially' for the moment and I'll use
x> Replace
x>> ReplaceAll
<_> Expand
<<_>> ExpandAll
++<_> ComplexExpand
>_< Simplify
>>_<< FullSimplify
as my examples of extending the aliases. I actually like using '_' as a placeholder symbol: it's apt. I'll update the tutorial and commit.
Edit: I noticed by '*'s were being hidden in the display.
That sounds good, thank you!
@light-matters this is now fixed, no?
@holyjak Yep, I think so.
clj-kondo tells us that "Symbols starting or ending with dot (.) are reserved by Clojure: =." - and we have couple more, such as
..> ..= =. . .>> .>
. This may cause problems sometimes - in particular, we've observed it when trying to build the site (clojure -T:build build-site
).In any case, I think we should aim to be on the save side and only use legal and unreserved symbols.
. * + ! - _ ? $ % & = < >.
If-
,+
or.
are the first character, the second character (if any) must be non-numeric. Additionally,: #
are allowed as constituent characters in symbols other than as the first character./
has special meaning in symbols. ..."*, +, !, -, _, ', ?, <, >
and=
, commenting that "other characters may be allowed eventually". (It must compile fn names containing these into class names, which are much more limited; currently, it does solve that by replacing some characters with safer forms, e.g.=
->_EQ_
.) I believe that in practice it accepts everything EDN does (minus reserved cases) so we could follow the richer EDN spec and hope for the best. Though it may be better to do that as little as possible and prefer to stick to the smaller clojure set. (Notice that.
and$
have special meaning in Java class names, compiled from clj fns; but perhaps clj is smart enough to replace them??; though our curren problem with._EQ_
demonstrates that dots, contrary to=
, are not replaced...)