Skip to content

mahyaret/CtCI-6th-Edition-CommonLisp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

CtCI-6th-Edition

Solutions for Cracking the Coding Interview 6th Edition by Gayle Laakmann McDowell.

Contributing

Work Flow

  1. Fork the appropriate repo for your language to your GitHub user.
  2. Write quality code and lint if applicable.
  3. Add tests if applicable.
  4. Open a pull request and provide a descriptive comment for what you did.

How to run the code

I personally found the combination of Emacs and Slime on top of SBCL gives the best IDE for common Lisp.

With Emacs+Slime+SBCL

  1. Install Emacs using the following

Linux:

sudo apt-get install emacs

Windows & MacOS:

https://www.gnu.org/software/emacs/download.html

  1. Install SBCL (also on Windows and MacOS)
sudo ./install.sh
  1. Setup Slime in Emacs
  • create .emacs in your home folder.
  • add following to this file:
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
  (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
  ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
  (when (< emacs-major-version 24)
    ;; For important compatibility libraries like cl-lib
    (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
;; Setting lisp system
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(setq slime-contribs '(slime-fancy))

and then restart emacs and run the following:

M-x package-refresh-contents
M-x package-install RET slime RET
  1. Clone this repo
  2. In Emacs, open slime
M-x slime

SLIME starts the Lisp system with the current directory taken from the directory where the file associated with the current buffer is. If you want to exit from slime:

, sayoonara
  1. In slime REPL run:
(load "Tester.lisp")

For Help

Best resource for Common Lisp can be found here: https://github.com/norvig/paip-lisp