2
$\begingroup$

What is an alternative to the backtick (`) in separating the namespace from the function name?

Can the function be called without using this symbol? I think in early versions of Mathematica one could use :: but it does not seem to work now.

$\endgroup$
  • 1
    $\begingroup$ You remember wrongly. :: (MessageName[]) was always intended for messages, and the backtick was always intended to delimit a context and a function from that context. What exactly is your problem with the backtick? $\endgroup$ – J. M.'s technical difficulties May 25 '12 at 7:15
  • $\begingroup$ @j.m On an iPhone/iPad entering a backtick is rather time consuming. So, editing code here on MMA.SE containing a context path is extremely annoying. Other than that, I can't think of a reason for wanting to replace the backtick. $\endgroup$ – Sjoerd C. de Vries May 25 '12 at 13:50
  • $\begingroup$ @SjoerdC.deVries maybe some write mma code on iPads? $\endgroup$ – acl May 25 '12 at 14:26
  • $\begingroup$ @acl Wolfram is rumored to develop a iPad implementation. I hope they include the W|A keyboard, as my experience with backticking code on an iPad has lead to quite some curses. $\endgroup$ – Sjoerd C. de Vries May 25 '12 at 15:25
  • $\begingroup$ @SjoerdC.deVries most likely a reader... $\endgroup$ – acl May 25 '12 at 15:46
6
$\begingroup$

Here's your alternative:

test`foo[x_] := x^2 (* original function in test` context *)
ToExpression["test" <> FromCharacterCode[96] <> "foo"][x] (* Look ma! No backticks! *)
(* x^2 *)
$\endgroup$
  • 1
    $\begingroup$ Even more baroque: ToExpression["test" <> "\\[" <> "RawBackquote" <> "]" <> "foo"][x] $\endgroup$ – J. M.'s technical difficulties May 25 '12 at 7:30
  • 1
    $\begingroup$ @J.M. ToExpression[ "test" <> Uncompress["1:eJxTTMoPCmZkYGBIAAAM0wH5"] <> "foo"][x] $\endgroup$ – rm -rf May 25 '12 at 7:36
  • 1
    $\begingroup$ That ain't baroque; that's grotesque. ;) $\endgroup$ – J. M.'s technical difficulties May 25 '12 at 7:40
  • 4
    $\begingroup$ @J.M. if it ain't baroque, don't fix it! $\endgroup$ – rcollyer May 25 '12 at 15:22
  • 1
    $\begingroup$ ToExpression[ TextRecognize@ Rasterize[ Style[Row[{"test", "\[NegativeVeryThinSpace]", Rotate[",", Pi/2, {0, 1.5}], "f"}], FontSize -> 40]]][x] $\endgroup$ – Rojo May 25 '12 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.