## `import::readlisp` -- parse Lisp-formatted string

#### Introduction

`import::readlisp(`s`)` parses the Lisp-formatted string `s` and returns the corresponding MuPAD expression.

#### Call(s)

`import::readlisp(s)`

#### Parameters

`s` | - | a string

#### Returns

a MuPAD expression of type `DOM_EXPR`

#### Related Functions

`generate::fortran`

#### Details

- `import::readlisp` returns the constructed MuPAD expression as an unevaluated call. So the result of `import::readlisp` is in every case of type `DOM_EXPR`.
- If the parsed string `s` contains only white spaces then the unevaluated call `null()` is returned.

#### Example 1

A first example:

    >> import::readlisp("(INTEGRATE (EXPT X -1) X)")

                                       / 1    \
                                    int| -, X |
                                       \ X    /

    >> import::readlisp("(EXP 2.0)")

                                     exp(2.0)

#### Example 2

In the example 1 above we can see that the corresponding MuPAD expression is not evaluated. Let us have a closer look on this behavior:

    >> domtype(import::readlisp("(INTEGRATE (EXPT X -1) X)")),
       eval(import::readlisp("(INTEGRATE (EXPT X -1) X)")),
       domtype(import::readlisp("(EXP 2.0)")),
       eval(import::readlisp("(EXP 2.0)"))

                      DOM_EXPR, ln(X), DOM_EXPR, 7.389056099

#### Example 3

Another example demonstrating that `import::readlisp` returns an unevaluated call:

    >> x := 2:  import::readlisp("(* x (/ 2 y))")

                                          2
                                        x -
                                          y

    >> eval(import::readlisp("(* x (/ 2 y))"))

                                         4
                                         -
                                         y

#### Example 4

An empty string is converted into an unevaluated call of `null()`:

    >> type(import::readlisp(""))

                                      "null"

Now we make a mistake while defining the Lisp string.

    >> import::readlisp("(* 2(EXP 3)")

          Error: missing closing parenthesis [import::parseLambda]

#### Changes

- used to be called `io::readlisp`
- In older versions of MuPAD `import::readlisp` used to return in a lot of cases an evaluated call, e.g., in older versions io::readlisp("(EXP 2.0)") returned a numerical value.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000