Table of Contents

Here is a tutorial summary of the Medley user documentation, with some example code snippets in Clojure:

1. Summary: Medley User Documentation

2. What is Medley?

Medley is a Lisp-based interactive programming environment and user interface development tool. It includes:

  • An implementation of Common Lisp with extensions (Interlisp-D)
  • A library of functions and tools for building user interfaces
  • Debugging and program analysis capabilities
  • Support for multimedia elements like images, animation, sound

Some key capabilities Medley provides:

  • Live coding - write and modify Lisp code interactively
  • GUI interface construction
  • Bitmap/image editing
  • Program tracing and inspection

3. Interactive Coding Workflow

A basic REPL loop allows entering code interactively:

user> (print "Hello world!")
Hello world!

The programmer's assistant provides shortcuts, like re-running previous expressions:

user> (def x 10)
user> x
user> (redo) ;; Last expression is re-run

4. User Interface Construction

Windows can be created programmatically:

(def window (create-window :title "My Window" 
                           :width 100 :height 200))

Menus allow building interactive interfaces:

(def menu (create-menu :title "File"
                       :items [["Open" #(do-open)]
                               ["Save" #(do-save)]]))

(show-menu menu)

5. Debugging and Analysis

Errors trigger a debugging prompt:

(defn divide [x y] 
  (/ x y))

(divide 10 0) ;; Triggers error  

In the debug REPL, the call stack can be inspected:

user> (bt) ; backtrace
(#'user/divide 10 0) 
(#'user/eval204 10 0)

The `spy` library tracks time spent in functions:


;; Run program

(spy/report) ;; Print profiling report

6. Extensibility

Libraries extend Medley's capabilities, like graphing, GUI layout, etc. User defined initialization scripts customize defaults.

7. References

8. Questions

  • How extensible is Medley - what languages or libraries can it be connected to?
  • How does the performance compare to more modern Lisp implementations?
  • What modern features are missing compared to languages like Clojure or Racket?

Author: Jason Walsh

Created: 2023-11-28 Tue 20:31