hamacs/ha-programming-scheme.org

86 lines
2.6 KiB
Org Mode
Raw Normal View History

2022-03-03 23:13:48 +00:00
#+TITLE: Programming in Scheme for SICP
#+AUTHOR: Howard X. Abrams
#+EMAIL: howard.abrams@gmail.com
#+DATE: 2022-03-01
#+FILETAGS: :emacs:
A literate programming file configuring Emacs.
#+BEGIN_SRC emacs-lisp :exports none
;;; ha-programming-scheme.el --- A literate programming file configuring Emacs. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2022 Howard X. Abrams
;;
;; Author: Howard X. Abrams <http://gitlab.com/howardabrams>
;; Maintainer: Howard X. Abrams
;; Created: March 1, 2022
;;
;; This file is not part of GNU Emacs.
;;
;; *NB:* Do not edit this file. Instead, edit the original literate file at:
;; /Users/howard.abrams/other/hamacs/ha-programming-scheme.org
;; And tangle the file to recreate this one.
;;
;;; Code:
#+END_SRC
* Introduction
First, install MIT-Scheme, the Lisp dialect used throughout the book:
=brew install mit-scheme= or =sudo apt install mit-scheme= .
#+BEGIN_SRC sh
brew install mit-scheme
#+END_SRC
Ah, hell, we should install them all!
#+BEGIN_SRC sh
brew install guile racket chicken
#+END_SRC
* Install Scheme
The [[https://www.nongnu.org/geiser/][geiser project]] attempts to be the interface between Emacs and various Schemes.
#+BEGIN_SRC emacs-lisp
(use-package geiser
:init
(setq geiser-mit-binary "/usr/local/bin/scheme"
geiser-active-implementations '(mit))
:config
(use-package geiser-mit) ; Choose favorite
(add-to-list 'org-babel-load-languages '(scheme . t)))
#+END_SRC
* Install SICP
Lets get the book available as an Info page:
#+BEGIN_SRC emacs-lisp
(use-package sicp)
#+END_SRC
* Try it Out
#+BEGIN_SRC scheme :results value
(define (fib n)
(if (< n 2) 1
(+ (fib (- n 1)) (fib (- n 2)))))
(fib 5)
#+END_SRC
* Technical Artifacts :noexport:
Looks like we need this, at least, temporarily.
#+BEGIN_SRC emacs-lisp
(add-to-list 'auto-mode-alist '("\\.info\\'" . Info-mode))
#+END_SRC
Let's =provide= a name so we can =require= this file:
#+BEGIN_SRC emacs-lisp :exports none
(provide 'ha-programming-scheme)
;;; ha-programming-scheme.el ends here
#+END_SRC
#+DESCRIPTION: A literate programming file configuring Emacs.
#+PROPERTY: header-args:sh :tangle no
#+PROPERTY: header-args:emacs-lisp :tangle yes
#+PROPERTY: header-args :results none :eval no-export :comments no mkdirp yes
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil date:nil
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js