# Tag Info

21

The brief forms /@, and @@@ are not exactly equivalent to the full forms of these operations, and also f[x] is not exactly equivalent to either of f[#]&[x] or f @@ {x}. I will mention two aspects of the problem, but there likely are more (of course, in addition to the precedence - related aspect, already extensively described in the linked past ...

13

Just to give everyone an update on this. Yes, this is a real bug. We identified the cause some time ago (certainly before 11 shipped). We are still working on a solution which doesn't break other things. I have been pestering the relevant folk from time to time as it annoys me too, though we are all in agreement that this is a significant issue worthy of ...

9

Like with the Notation package?

9

If you do a performance test (say, using a million random numbers), you'll find that f = (3+#) & is the fastest. f[x_]:=3+x is significantly slower. One way to think of @@ (i. e. Apply) is as "replace Head". Because that's exactly what it does. It removes the Head and puts whatever other Head you have provided. Very practical, but not always run-time ...

5

Why not use an InputAutoReplacements instead? For example: CurrentValue[EvaluationNotebook[], {InputAutoReplacements, "ww"}] = "Ω" Then you can type: w w Control+- to enter the desired subscript. If you really want to use KeyEventTranslations.tr to do this, then you need to enter boxes: Item[KeyEvent["O", Modifiers -> {Control, Command, Shift}], ...

5

These are all functionally equivalent forms of a Pure Function, sometimes called an anonymous function. body[#] & I use the operator form body[#]& when there is only one argument, but you can define a more complicated body using #[[2]] (Part) and #2 (Slot) used with List and Sequence arguments respectively. Function[body[#]] The full form ...

5

In order to be recognised as symbols the subscripted forms need to be keyed in control-_, you cannot explicitly use Subscript: When you use Subscript[] the arguments are replaced by their values before being passed to the function, but if you do x Ctrl+_ 1 the Notation package can grab it before the replacement.

5

Here's something you can try: CurrentValue[EvaluationNotebook[], {InputAliases,"ch"}] = ActionMenuBox[ "g1", { "g1":>NotebookWrite[EvaluationBox[], "g1"], "g2":>NotebookWrite[EvaluationBox[], "g2"] }, Appearance->"PopupMenu", AutoAction->True ] A short animation: The left hand side of the rule is what you see in the ...

5

You can use a TemplateBox in your alias to control how the alias is interpreted: CurrentValue[EvaluationNotebook[], InputAliases] = DeleteDuplicates @ Prepend[ CurrentValue[EvaluationNotebook[], InputAliases], "ndint" -> TemplateBox[ {"\[Placeholder]","\[Placeholder]","\[Placeholder]","\[SelectionPlaceholder]"}, "ndint", ...

5

Please try: SetOptions[EvaluationNotebook[], InputAliases -> { "aa" -> RowBox[{"AFunctionWithAVeryLongName", "[", "\[SelectionPlaceholder]", "]"}] } ] A placeholder with a name does not seem possible with Input Aliases.

4

CurrentValue[$FrontEndSession, {InputAliases, "xx"}] = "X" or, if you want the new settings to persist across sessions, use CurrentValue[$FrontEnd, {InputAliases, "xx"}] = "X"

3

I'll provide two approaches Cleaner My guess is this is an issue with the nasty syntax for using boxes in strings. A better approach is probably to write the boxes directly. Here's one that works for me: CurrentValue[EvaluationNotebook[], {InputAliases, "ch"}] = ActionMenuBox[ DynamicBox[ FEPrivatePart[ FEPrivateObjectContents[ ...

2

As of 11.3 this is still an issue. Following the suggestion of @KellenMyers in the comments above, I altered my KeyEventTranslations.tr file (located in "\$InstallationDirectory/SystemFiles/FrontEnd/TextResources/X/" in the Linux distribution) in the following manner to obtain the desired behavior for InputAliases and InputAutoReplacements with \[...

2

In answer to your first question, you can refer to the various special forms of input depending on where and how it is used in the expression. Mathematics and Mathematica both use forms such as prefix, infix and postfix form. You can read more here: Special ways to Input Expressions For completeness, I'll show several obvious examples: Prefix form f(x): ...

2

Eliminate the extra spaces in the alias definition: SetOptions[EvaluationNotebook[], InputAliases -> {"xx" -> "\!$$\*SubscriptBox[\(x$$,$$\[SelectionPlaceholder],\[Placeholder],\ \[Placeholder]$$]\)"}] SetOptions[EvaluationNotebook[], InputAliases -> {"yy" -> "\!$$\*SubscriptBox[\(y$$, $$x,y,z$$]\)"(*subscripts*)}]

2

The Notation package can help you here. This definition interprets all definite integral expressions as being NIntegrate rather than Integrate Needs["Notation`"] Notation[ParsedBoxWrapper[ RowBox[{ SubsuperscriptBox["∫", "u_", "v_"], RowBox[{"f_", RowBox[{"\[DifferentialD]", "x_"}]}]}]] ⟹ ParsedBoxWrapper[ RowBox[{"NIntegrate", "[", RowBox[{"f_", ","...

1

I'm assuming you're talking about the menu from my code here. If that's the case we can have the DynamicBox act differently if it's in the code assist popup (which is a special interface element that has no EvaluationCell[]) relative to a standard cell. That'll look like: CurrentValue[EvaluationNotebook[], {InputAliases, "ch"}] = With[{baseBox = ...

1

First of all, if you use: SetOptions[EvaluationNotebook[], InputAliases -> {"xx" -> "X"}] then you will replace all aliases with this one. But if you only want to add new one, there is a convenient way to add a suboption: CurrentValue[EvaluationNotebook[], {InputAliases, "xx"}] = "X" Now, all previous aliases are preserved. Ok, to the point. I ...

1

You can remove unwanted blanks by manually pasting \[NegativeThinSpace].

1

You can create a placeholder with a name if you use a TemplateBox: CurrentValue[EvaluationNotebook[], {InputAliases,"aa"}] = RowBox[{ "AFunctionWithAVeryLongName", "[", TemplateBox[{},"SelectionPlaceholder",DisplayFunction->(FrameBox["\"input\""]&)], "]" }]; Then, using the alias "aa" produces: which can be selected by tabbing. Alas,...

Only top voted, non community-wiki answers of a minimum length are eligible