# Usage of \[InvisibleApplication] and other related invisible characters

From the front end, \[InvisibleApplication] can be entered as Esc @ Esc, and is an invisible operator for @!. By an unfortunate combination of key-presses (there may have been a cat involved), this crept up in my code and I spent a great deal of time trying to figure out why in the world f x was being interpreted as f[x]. Example:

Now there is no way I could've spotted this visually. The *Forms weren't of much help either. If you're careful enough, you can see an invisible character between f and x if you move your cursor across the expression. Eventually, I found this out only by looking at the contents of the cell.

There's also \[InvisibleSpace], \[InvisibleComma] and \[ImplicitPlus], which are analogous to the above. There must be some use for these (perhaps internally), which is why it has been implemented in the first place. I can see the use for invisible space (lets you place superscripts/subscripts without needing anything visible to latch on to), and invisible comma (lets you use indexing like in math). It's the invisible apply that has me wondering...

The only advantage I can see is to sort of visually obfuscate the code. Where (or how) is this used (perhaps internally?), and can I disable it? If it's possible to disable, will there be any side effects?

-
\[InvisibleComma] is sometimes useful for array indexing. For instance, {{a, b, c}, {d, e, f}}\[LeftDoubleBracket]2\[InvisibleComma]3\[RightDoubleBracket]. This is a bit nicer if the \[LeftDoubleBracket]2\[InvisibleComma]3\[RightDoubleBracket] portion is input as a subscript... –  Ｊ. Ｍ. Jan 18 '12 at 11:56

It is used in TraditionalForm output, e.g. here:

TraditionalForm[ Hypergeometric2F1[a,b,c,x] ]


Without \[InvisibleApplication] it would probably be hard for Mathematica to parse it back to InputForm. Probably it is used in more places internally.

In order to get rid of it:

Locate the file UnicodeCharacters.tr in /usr/local/Wolfram/Mathematica/8.0/SystemFiles/FrontEnd/TextResources (or the equivalent under Windows or MacOSX), make a backup of the file, open it and delete the line

0xF76D         \[InvisibleApplication]         ($@$ ...


Then your cat can jump on the keyboard again.

-

C@ts have baffled humans since Schroedinger's time... at least. Recent research seems to suggest that Mathematica invisible characters stimulate visual and pleasure centers in the cat's brain. Exspecially the "@" character with its long mouse tail.

In category theory, a fundamental branch of mathematics, it was a common (mal)practice to describe functorial application using (what amounts to) an "invisible @". For example, applying functor $F$ to object $A$ was simply written as $$FA$$ My category package Wildcats, being feline friendly and Mathematica based, indeed allows the user to indulge in this (mal)practise, but does not encourage it. In fact a warning describing the perils of using invisible characters has been prominenty present in Wildcats documentation since the earliest versions. Some human users may not have noticed it since it's currently written with invisible characters.

-
This is one of the most humorous yet enlightening answers I have seen in a while... +1! –  Thomas Oct 23 '13 at 12:03
Thank you @Thomas , I am relieved. Some users, in some other branches of StackExchange, frown upon humor. Fortunately here at MMA.SE we have built a better community. –  magma Oct 25 '13 at 9:28

I don't think that invisible characters have any internal uses. They are probably just to make expressions look nice to us humans. The place I can think of using \[InvisibleApplication] is as some group action
g x = g[x], but there are sure to be other places.

As for making invisible characters visible. You can make all special characters explicit using

SetOptions[EvaluationNotebook[], ShowSpecialCharacters -> False]


but this effects things like \[Rule] (->), Greek characters (\[Alpha]) etc...

There's another notebook option

SetOptions[EvaluationNotebook[], ShowInvisibleCharacters -> None]
(* or ShowInvisibleCharacters -> All, True, False *)


which sounds like it should be what you're looking for, but does not seem to do anything.

I guess that editing the UnicodeCharacters.tr file (like Rolf suggests) is the way to go. (This was going to be the next thing I tried, but was beaten to it!)

-

You could de-obfuscate it something like this:

MakeExpression[RowBox[{a_, "\[InvisibleApplication]", b_}], StandardForm] :=
HoldComplete[invisibleapply[a, b]]


After which:

In[13]:= f\[InvisibleApplication] x
Out[13]= invisibleapply["f", "x"]


I think these invisible characters can be useful for approximating traditional mathematical notations, but in general sticking to standard mathematica notation, square brackets and all, is less confusing.

In general, for debugging this kind of problem where a cell doesn't parse as you expected, the "Show Expression" command (Ctrl+Shift+E) can be invauluable.

-
but that still does not stop the cat from hitting Esc @ Esc again ... –  Rolf Mertig Jan 17 '12 at 21:29
Yeah, the show expression is how I figured out these functions. I can see the use for invisible space (lets you place superscripts/subscripts without needing anything visible to latch on to), and invisible comma (lets you use indexing like in math). It's the invisible apply that has me wondering... –  rm -rf Jan 17 '12 at 21:29
Invisible apply would give rise to things like operator notation (where Ax means "apply operator A to vector x") and combinator formalism (where KS means "apply combinator K to combinator S"). –  celtschk Jan 18 '12 at 7:38