-
If you don’t have homebrew (just type
brew -v
in a terminal to test), I adviseyou to install it as it makes it easier to install apps, command line tools, and similar things, as well to update them. To do that, just run this from command line:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Test if you have sbcl (
sbcl -v
) otherwise install by running:brew install sbcl
-
Install Visual Studio Code if you don't have it. You can do this by running:
brew install --cask visual-studio-code
-
Install quicklisp if you don't have already:
cd curl -O https://beta.quicklisp.org/quicklisp.lisp sbcl --load quicklisp.lisp
sbcl will start, loading the quicklisp.lisp file that allows to install quicklisp... run:
(quicklisp-quickstart:install) (ql:add-to-init-file) (quit)
-
If you also want use emacs, run the following lines in the terminal to setup a
.emacs
config file:
echo '(load (expand-file-name "~/quicklisp/slime-helper.el"))\n(setq inferior-lisp-program "sbcl")' >> ~/.emacs
- Download and unzip idyom:
cd ~/quicklisp/local-projects/ && curl -O https://github.com/mtpearce/idyom/archive/refs/tags/v1.7.1.zip && unzip v1.7.1.zip
- We need to add some lines to
.sbclrc
(SBCL configuration file) so that it loads clsql, when started, and has a function definition to start idyom. You can do this by copying this to your terminal:
echo '
;; Loads clsql by defaylt: clsql is a package to deal with SQL databases
(ql:quickload "clsql")
;;; Define function to start IDyOM
(defun start-idyom ()
(defvar *idyom-root* (merge-pathnames "idyom/" (user-homedir-pathname)))
(defvar *idyom-message-detail-level* 1)
(ql:quickload "idyom")
(clsql:connect `(,(namestring (merge-pathnames "idyom/db/database.sqlite" (user-homedir-pathname)))) :if-exists :old :database-type :sqlite3))' >> ~/.sbclrc
- Althought IDyOM should automatically create all directories needed to work, it does not create the
~/idyom/db/
folder, where it stores the database file. So, let's create it pasting this to the terminal:
mkdir -p ~/idyom/db
- Run sbcl and start IDyOM
sbcl
(start-idyom)
- In the first run, you will need to initialise the database (this command cleans everything if you have already created one, so don't run it in further interactions if you don't want to wipe everything inside IDyOM's database):
(idyom-db:initialise-database)
- Install the Common Lisp Extension (author: Qingpeng Li): ![[Pasted image 20240307102844.png]]
- Configure a shortcut to run selected regions of a file in the terminal:
- (Cmd+Shift+P) and search for "Run Selected Text in Active Terminal" ![[Pasted image 20240307103114.png]]
- Click in keybinding and press the keybinding (ex: Cmd+ Enter). Then press Enter to assign.
- Create some lisp file anywhere and type (+ 2 3), just to test a simple sum
- Open the integrated Terminal (Ctrl+`)
- In the terminal, run sbcl (
sbcl
) - Select the sum in the text file and use your shortcut.