This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Parse Lisp-formatted string

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.




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

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 null() expression is returned.


Example 1

A first example:

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

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

Example 2

In Example 1 above we can see that the corresponding MuPAD expression is not evaluated. Let us have a closer look at 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)"))

Example 3

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

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

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

Example 4

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


We try to convert an illegal Lisp string:

import::readlisp("(* 2(EXP 3)")
Error: Missing closing parenthesis. [import::parseLambda]



A string

Return Values

MuPAD expression of type DOM_EXPR

Was this topic helpful?