EMACS 25.1 + SLIME on Windows 10

Here is my Lisp Development Environment setup on Windows 10:

  1. Clozure Lisp http://ccl.clozure.com/
    Unzip the Windows Zip ftp://ftp.clozure.com/pub/release/1.11/ccl-1.11-windows.zip
    Add the Lisp path to PATH variable.
  2. EMACS 25.1
    Unzip the Windows 64 binaries emacs-25.1-x86_64-w64-mingw32.zip and run bin/runemacs.exe
  3. QuickLisp
    Download the QuickLisp lisp files https://beta.quicklisp.org/quicklisp.lisp
    Run

    wx86cl64.exe -load <path to quicklisp.lisp>
  4. SLIME
    Open your emacs configuration file in EmacsCTRL+X CTRL+F -then-> ~/.emacsThen insert following entries to enable MELPA repository

    (when (>= emacs-major-version 24)
     (require 'package)
     (add-to-list
     'package-archives
     '("melpa" . "http://melpa.org/packages/")
     t)
     (package-initialize))

    Now restart Emacs. After restart type  ALT+X and type

    package-install RET slime

    Then set following values in Emacs configuration file (“~/.emacs”)

    ;;; Lisp - SLIME
    
    (setq inferior-lisp-program "C:/ccl-1.11-windows/wx86cl64.exe")
    
    (setq slime-contribs '(slime-fancy))

    Now on restart of Emacs, when I type CTRL+X slime I get following SLIME prompt

screenshot-13

Enjoying Lisp + Emacs

Advertisements

Learning Lisp

Yesterday, I happen to read a comic based Lisp tutorial at www.lisperati.com. It was fun to go through the tutorial which very easily introduces to Lisp and creates a Text-based adventure game in Lisp.

After playing the game, I build up my first Emacs Lisp function to restart the game.

 

Restart function in Emacs Lisp

(defun restart ()
        (progn
         (setq object-locations
           (remove-if (lambda (x)
             (eq 'body (second x)))
              object-locations))
         (look)))

Explanations:
On line two I have used progn function, that takes a list of forms to execute and returns the result of last form execution. In this function, I have two forms, first one to clear from object-locations the user inventory i.e. items picked in the play. The second form starts the game with look function

To reset user inventory, I have used remove-if function to clear from object-locations list all items that belongs to user body and then set the result list back to object-locations. Even though this is not pure Functional programming, it is step towards it as instead of modifying the existing list, a list is created by filtering and assigned as new object-locations list.

Happy Lisping.