Your first program collects a symbol, a string, and a sum into one list. You run it in the browser with no installation, change the sum, and repair a missing parenthesis.
Run it in the Playground
Open the Playground, replace the editor contents with this program, and choose Run.
(define language "Lispex")
(list 'hello language (+ 2 3))Result
(hello "Lispex" 5)define gives the string "Lispex" the name language. The final expression
calls list to collect three values. They are the symbol hello, the string
stored as language, and the sum of 2 and 3. The quote before hello
keeps that name as data.
The Playground shows the values of expressions written at the outermost level
of the program. define itself produces no displayed value.
Change 3 to 8 and run again.
Result
(hello "Lispex" 10)The last item changes because (+ 2 8) returns 10. The symbol and string
stay the same.
Fix a missing parenthesis
Replace the editor contents with this example. Its first line is missing a closing parenthesis.
(define total 10
(+ total 5)Lispex reports error E100. It cannot finish reading the first expression,
so it runs none of the program. Add ) after 10 and run again.
Result
15The corrected program defines total as 10, then adds 5.
See Error and Warning Codes for errors during reading,
syntax expansion, execution, or resource use.
Exercise
Return to the first program and change it to produce this result.
(hello "Lispex" 12)Show one answer
Change the final expression to (list 'hello language (* 3 4)). Lispex
calculates (* 3 4) before list receives its three values.
Run it on your computer
Install Native or npm from Downloads. Then save the original
program as hello.lspx.
(define language "Lispex")
(list 'hello language (+ 2 3))With the npm package installed in your project, run the file with npx.
npx lispex hello.lspxWith Native, run the same file with lispex.
lispex hello.lspxBoth commands print this result, exit with status 0, and create no files.
(hello "Lispex" 5)Save the program with the missing parenthesis as unfinished.lspx.
(define total 10
(+ total 5)Run it with Native.
lispex unfinished.lspxThe command exits with status 1 and writes this diagnostic to standard error.
E100 unfinished.lspx:1:1 unterminated list (missing `)`)To compare the Playground, npm, and Native, see Choose where to run on Downloads.
To call a rule from your own application, read Run Lispex in Your Application.
The editor extension on Downloads adds syntax highlighting and formatting.
Continue to the Learning Path
When you can explain the name, string, nested call, and final list, continue to the Learning Path. It lists the lessons that lead to your first decision rule.