#!/usr/local/bin/sbcl --script (;; Learning to code Common Lisp ;; This lisp calculates the area of a circle ;; Courtesy of www.tutorialspoint.com/lisp/lisp_input_output.htm ;; ;; the function AreaOfCircle ;; calculates the area of a circle ;; when the radius is input from keyboard (defun AreaOfCircle ()) ;; AreaOfCircle is defined as a blank function at this time (terpri) ;; prints a newline (princ "Enter Radius: ") ;; format t,, prin1 and princ all prints to the screen ;; princ tends to look better at it, though (setq radius (read)) ;; setq sets a variable ( in C this would have to defined as an integer ;; float, long float...etc.. at the top as Int long float (radius) ;; (setq area (* 3.1416 radius radius)) ;; declare another function called radius which equals ;; whatever our raidius is times pi (3.1416) * radius to ;; the second power to create the area itself ;; (write area) ;; Now that we've done the math, we need to print it to the ;; screen as the variable Area. That's what this command is doing ;; at this point. ;; (AreaOfCircle) ;; Now we're giving program a routine to start with, which ;; we've already created at the top, analogous to the C ;; (int main ), however, we don't have to declare a main ;; on this program, just give it the routine name to start with.