7
$\begingroup$

I'm looking for an exhaustive list of symbols that work:

  1. On the cmd line kernel (without a Front-End)
  2. Only in a notebook (with a Front-End)
  3. In the Wolfram cloud (in the paid version and the free lab version)
$\endgroup$
  • 1
    $\begingroup$ What have you tried so far? Are you restricting this to only documented symbols, or symbols overall? What is your definition of "work"? $\endgroup$ – user6014 Nov 5 '18 at 18:21
  • $\begingroup$ Do you really want an exhaustive list (which I can't provide—I doubt anyone can) or just some useful hints for making good guesses about which functions require the FE? $\endgroup$ – Szabolcs Nov 5 '18 at 18:23
  • $\begingroup$ @user6014 Nothing. Documented. Work means it can execute as documented. $\endgroup$ – M.R. Nov 5 '18 at 18:23
  • $\begingroup$ @Szabolcs I think it is important to know if the code you have will run on the command line $\endgroup$ – M.R. Nov 5 '18 at 18:24
  • $\begingroup$ Also: it's not entirely clear what it means that a symbol requires the FE. Take e.g. Defer. It doesn't "not work" in command line mode, but it's pretty pointless. $\endgroup$ – Szabolcs Nov 5 '18 at 18:24
9
$\begingroup$

I cannot give you an exhaustive list of symbols, and I think it is even debatable what it means that "a symbol requires the FE". But I think I can try to help with this:

I think it is important to know if the code you have will run on the command line

The broad categories of functions that require the FE to work are:

  • Things that deal with clearly FE-related concepts, such as notebooks. I think it is not worth discussing these, as they are pointless on the command line. The presence of a notebook interface can be tested for using $Notebooks.

  • Dynamic / Manipulate related things clearly require the FE

  • What is perhaps surprising is that graphics export and rasterization requires the FE. Exporting to bitmap or vector formats, Rasterize, Image@Graphics[...], etc. all require a front end. This is the single most common cause of code failing when run on the command line.

  • Functions whose purpose is somehow associated with using a graphical interface typically require an FE. This category is quite vague and sometimes counterintuitive. Examples: SystemOpen requires an FE, loosely because it is the equivalent of opening files with the Finder (Mac) or Explorer (Windows). It will ultimately handle file type associations. It can also open web addresses, for which one expects to use a graphical browser (even if technically one could use lynx). Compare it with Run, which just launches and executable, can be implemented with plain POSIX stuff, and does not require an FE.

  • Some, but not all, sound-related functions require an FE. One example is EmitSound. The newer Audio-related equivalents (such as AudioPlay) seem to work without an FE.

It should be noted that normally, even when the kernel is running in command line mode, it will reach a hidden FE as needed to evaluate such functions. For some low-level functions this is not automatic and one must use UsingFrontEnd. On Linux, the FE requires an X server so you must provide one for it.

$\endgroup$
  • 2
    $\begingroup$ There is certainly more, and people are welcome to edit the list. $\endgroup$ – Szabolcs Nov 5 '18 at 18:50

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.