using_ecl_embeddable_common-lisp_on_sdf
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
using_ecl_embeddable_common-lisp_on_sdf [2021/03/11 05:30] – [ECL Basics] hc9 | using_ecl_embeddable_common-lisp_on_sdf [2021/03/11 05:41] – [References:] hc9 | ||
---|---|---|---|
Line 56: | Line 56: | ||
< | < | ||
- | | + | % echo ' |
- | | + | % ecl -norc -script hello.lsp |
- | Hello SDF | + | Hello SDF |
</ | </ | ||
Line 65: | Line 65: | ||
It's also possible to use ECL to execute simple Common-Lisp one-liners at the command line (note that //princ// is needed for screen output): | It's also possible to use ECL to execute simple Common-Lisp one-liners at the command line (note that //princ// is needed for screen output): | ||
- | | + | < |
- | 6 | + | |
+ | % ecl -norc -shell /dev/null -eval " | ||
+ | 6 | ||
+ | |||
+ | </ | ||
A nicer way to accomplish the same is to create a small shell script: | A nicer way to accomplish the same is to create a small shell script: | ||
Line 72: | Line 76: | ||
< | < | ||
- | | + | #!/bin/sh |
- | # lispit - executes a lisp expression and dumps it to stdout | + | # lispit - executes a lisp expression and dumps it to stdout |
- | | + | LSP_EXPR=${@} |
- | | + | if [ " |
- | echo " | + | echo " |
- | echo " | + | echo " |
- | echo "" | + | echo "" |
- | exit 1 | + | exit 1 |
- | fi | + | fi |
- | | + | ecl -norc -shell /dev/null -eval " |
- | echo "" | + | echo "" |
- | exit 0 | + | exit 0 |
</ | </ | ||
Line 92: | Line 96: | ||
Example run: | Example run: | ||
- | | + | < |
- | (1 4 9 16 25) | + | |
+ | % lispit ' | ||
+ | (1 4 9 16 25) | ||
+ | |||
+ | </ | ||
===== ASDF / enabling readline ===== | ===== ASDF / enabling readline ===== | ||
Line 103: | Line 111: | ||
1) Create the user-level ASDF repository: | 1) Create the user-level ASDF repository: | ||
- | | + | < |
+ | |||
+ | % mkdir -p $HOME/ | ||
+ | |||
+ | </ | ||
2) Create the ASDF config directory and config file*: | 2) Create the ASDF config directory and config file*: | ||
Line 109: | Line 121: | ||
< | < | ||
- | | + | % cd $HOME |
- | % mkdir -p .config/ | + | % mkdir -p .config/ |
- | % vi .config/ | + | % vi .config/ |
- | | + | # ../ |
- | ;; | + | ;; |
- | (:directory "/ | + | (:directory "/ |
</ | </ | ||
Line 123: | Line 135: | ||
3) Download ecl-readline module and copy select files to $HOME/ | 3) Download ecl-readline module and copy select files to $HOME/ | ||
- | | + | < |
- | % snarf http:// | + | |
- | % tar xzf ecl-readline-0.4.1.tar.gz | + | % cd /tmp |
- | % cd ecl-readline-0.4.1/ | + | % snarf http:// |
- | % cp ecl-*.* $HOME/ | + | % tar xzf ecl-readline-0.4.1.tar.gz |
+ | % cd ecl-readline-0.4.1/ | ||
+ | % cp ecl-*.* $HOME/ | ||
+ | |||
+ | </ | ||
4) Create the ECL startup file: | 4) Create the ECL startup file: | ||
- | | + | < |
- | (require ' | + | |
- | (asdf: | + | # $HOME/ |
- | (ecl-readline:: | + | (require ' |
+ | (asdf: | ||
+ | (ecl-readline:: | ||
+ | |||
+ | </ | ||
The next time you startup ECL it will compile the ecl-readline module and launch an interactive session. With ecl-readline enabled the default ECL prompt is "// | The next time you startup ECL it will compile the ecl-readline module and launch an interactive session. With ecl-readline enabled the default ECL prompt is "// | ||
Line 144: | Line 164: | ||
< | < | ||
- | | + | # $HOME/ |
- | (require ' | + | (require ' |
- | (setf ASDF: | + | (setf ASDF: |
- | (setf *load-verbose* nil) ; quiets the LOAD process some | + | (setf *load-verbose* nil) ; quiets the LOAD process some |
- | (asdf: | + | (asdf: |
- | (ecl-readline:: | + | (ecl-readline:: |
- | ;; | + | ;; |
- | ;; customizations | + | ;; customizations |
- | | + | ;; GNU clisp-like SHELL cmd |
- | (defun shell (& | + | (defun shell (& |
- | "Args: (& | + | "Args: (& |
- | SHELL calls the EXT:SYSTEM function. Executes SHELL_CMD if given, otherwise | + | SHELL calls the EXT:SYSTEM function. Executes SHELL_CMD if given, otherwise |
- | User sub-shell is spawned. SHELL_CMD be string or symbol, 256 characters max." | + | User sub-shell is spawned. SHELL_CMD be string or symbol, 256 characters max." |
- | | + | |
</ | </ | ||
Line 172: | Line 192: | ||
---- | ---- | ||
- | $Id: ecl_tutorial.html, | + | $Id: ecl_tutorial.html, |
using_ecl_embeddable_common-lisp_on_sdf.txt · Last modified: 2021/03/12 18:34 by hc9