readstring
readstring(t_string) =>g_result/nil
Description
Returns the first expression in a string. Subsequent expressions in the string are ignored. The expression is not processed in any way.
Arguments
Value Returned
Examples
The following example shows normal operation.
readstring("fun( 1 2 3 ) fun( 4 5 )") => ( fun 1 2 3 )
The following example shows the error message if the string contains a syntax error.
readstring("fun(" )
fun(
^
SYNTAX ERROR found at line 1 column 4 of file *string*
*Error* lineread/read: syntax error encountered in input
*WARNING* (include/load): expression was improperly terminated.
The following example illustrates that readstring applied to the print representation of an expression, returns the expression.
EXPRESSION = 'list( 1 2 )
=> list(1 2)
EXPRESSION == readstring( sprintf( nil "%L" EXPRESSION ))
=> t
Related Topics
Return to top