Miscellaneous Unknown Spots

Starting scilex

For debugging purposes it is sometimes desirable to start the main Scilab binary, scilex directly. Scilab is usually launched via the scilab script. Both, the script and the binary live in the SCI/bin directory. The script takes care of setting all environment variables and finally fires up scilex. On the other hand, if you want to run a debugger, say gdb, or ddd, or a profiler on Scilab then a manual invocation is the order of the day. Starting scilex is easy as long as you are not hooked by all the command-line editing goodies, and there is no need for any graphics. Actually, for minimum functionality only the environment variable SCI must be set, then we are all set to call scilex. A bash sequence to start Scilab "manually" could look as shown in Example 4-4.

Example 4-4. Manually launching scilex

        lydia@orion:~$ cd /site/X11R6/src/scilab
        lydia@orion:/site/X11R6/src/scilab$ SCI=`pwd`
        lydia@orion:/site/X11R6/src/scilab$ export SCI
        lydia@orion:/site/X11R6/src/scilab$ cd bin
        lydia@orion:/site/X11R6/src/scilab/bin$ ./scilex -nw
                                   ===========
                                   S c i l a b
                                   ===========


                                  Scilab-2.5
                          Copyright (C) 1989-99 INRIA


        Startup execution:
          loading initial environment

        -->
    

or shorter

        lydia@orion:~$ export SCI=/site/X11R6/src/scilab   
        lydia@orion:~$ $SCI/bin/scilex -nw
                                   ===========
                                   S c i l a b
                                   ===========


                                  Scilab-2.5
                          Copyright (C) 1989-99 INRIA


        Startup execution:
          loading initial environment

        -->
    

where we are assuming that Scilab is installed in /site/X11R6/src/scilab.

Tuple Assignment

The most commonly used form of assignment is single-assignment. Nonetheless, assigning multiple values in one statement is possible (and no surprise for Perl or Python programmers).

    -->[x1 x2 x3] = (1, 2, 3)
     x3  =
        3.  
     x2  =
        2.  
     x1  =
        1.  

See: parents

Omitting Parentheses on Function Call

The parentheses of any one-parameter function can be omitted, if the function accepts a string argument. Moreover, the quotes for a literal string argument can be left out, too.

The is especially useful, when working interactively and loading functions or scripts. There is no need to type until your fingers bleed by saying

    -->getf("foo.sci")

as the next two examples work just as well.

    -->getf "foo.sci"

and even

    -->getf foo.sci

is OK. Note that this is not only true for built-in, but also for user-defined functions.

Function exec is an exception to the rule that a semicolon suppresses any output of the preceeding clause. [1] exec does echo all commands when used without parenthesis despite a trailing semicolon, i.e.

    -->exec script.sci;

with semicolon gives same results as

    -->exec('script.sci')

without semicolon, whereas

    -->exec('script.sci');

does not echo the commands in the script file.

Notes

[1]

Thanks to Glen Fulford for reporting this.