Recently reading SICP This book, the code in the book is used to scheme
implement. Before reading the time is used Dr.Racket
to complete the writing exercise, but I think with this, rather than one step, using emacs+lisp
the interpreter to come faster.
Installing Emacs
Direct click on the official tutorial point I view, the above explained very clearly, basically different system installation method is similar, download after click to run, or very simple bar.
Installing the LISP Interpreter
Lisp has countless implementations of the version, here I use Racket
, because I have a computer on the previous Dr.Racket
so do not download, if you do not, you can click on the racket, select the appropriate version of the system to download, of course, you can choose other Lisp dialect implementation version, For example Petite Chez Scheme. After downloading the decompression can be.
After downloading, you can get some of these programs
Next, set the folder path where the interpreter is located to the system path (windows= environment variable, mac/linux= $path
), and then tap on the terminal racket --version
to check if the setting is successful. If the following information appears, you will succeed.
Install some of the necessary and effective plugins
We need to install a few simple plugins to help us write and run the code efficiently.
Set plug-in source
Similar to the Linux installation software, here we set MELPA
the installation source, so that we can install the code in one click, very convenient.
In view of the slow speed of foreign visits, we use the domestic image source, here to thank the people who have been maintaining free software, or the settings and configuration of these tools where there will be so easy and convenient:)
emacs
All of the configuration in ~/.emacs
this file, for Windows, is in the C drive under the Personal directory folder. We can make some custom configurations for Emacs by editing this file. Open the. emacs file, add the following configuration to the end of the file, and set up our plugin installation source.
;; melpa 安装源(require 'package)(add-to-list 'package-archives '("melpa""http://elpa.emacs-china.org/melpa/") t)(package-initialize)
This makes it easy to install the plugin.
Installing Racket-mode
Racket-mode
Very good, execute code, highlighting, hint, anyway, I think there are OK, the following installation.
Using the following command M-x package-install <ret> racket-mode
, M stands alt
for the meaning of the key combination, which represents the ret
carriage return, so the command is actually
alt+x
Open Command mode
- Input
package-install
(can be prompted with the SPACEBAR/tab), enter
- Then enter the name of the plugin to be installed
racket-mode
, enter confirm, wait for the installation to complete.
How about, it's easy.
After the installation is complete, add the following code to the configuration file configuration .emacs
file
;;racket配置,设置解释器,自动补全,代码执行等"racket""raco")(add-hook 'racket-mode-hook (lambda () "C-x C-j"
Installing Paredit
ParEdit
is a semi-structured editing of Lisp plug-ins, such as the automatic completion of parentheses, S-expression transfer, extraction, etc., or is very convenient.
Use M-x package-install <ret> paredit-mode
the same installation.
The specific use method is not the focus of this article, you can refer to the following article
- Emacs Paredit Plugin
- Settings for the Scheme programming environment
- Official Card Guide
Hello World
When all is set up, we create a new file ( ctrl+x 回车 i 回车 输入文件名
) and enter the following code
#! /usr/bin/env racket#lang racket(displayln "Hello World!")
Then use the F5
execute S-expression, the successful print out Hello World
At this point, the installation Emacs
and setup racket
environment is complete.
Resources
- Emacs Quick Start
- Emacs Paredit Plugin
- Settings for the Scheme programming environment
- Paredit Official Card Guide
- Emacs Simple Tutorial Series
- Starting with the zero---emacs installation configuration tutorial
Installing Emacs and setting up the racket environment