This page is part of the CS320: Programming Languages Course on the Computer Science Department's WWW Server at CalState, San Bernardino, California, USA. It was generated by Doc Dick Botting.


Contents


    Samples

      Simple LISP Code

      How COND works: [ cond.lsp ] [ pg055.lsp ]

      State Taxes using COND: [ pg051.lsp ]

      Factorials [ factorial.lsp ]

      Function to test if argument is an odd number: [ odd.lsp ]

      Function to construct a list of binary digits [ enigma.lsp ]

      Summing items in numeric list: [ pg055.lsp ] [ pg053.lsp ]

      Generate the reverse of argument: [ reverse.lsp ]

      Print out list structure: [ show.lsp ]

      Eratsthene's Sieve: [ sieve.lsp ]

      Simple Statistics: [ stats.lsp ] [ stats.scm ] (translated to guile scheme).

      A Sort: Analysis and design [ sort.html ] + code [ sort.lsp ]

      The same algorithm implemented with a common functional form written once rather than three times: [ sortfun.lsp ]

      Useful LISP Code

      Print out the internal structure of a list: [ show.lsp ]

      Converting atoms to lists and vice versa [ bletch.lsp ]

      Advanced LISP Code

      [ adder.lsp ]

      Stats: [ ss.lsp ]

      Mapcar and maplist: [ mapcar.lsp ] [ maplist.lsp ]

      Functions as arguments of functions: [ fun.lsp ] [ apply.lsp ] [ sortfun.lsp ]

      Let: Blocks in LISP [ let.lsp ] [ classy.lsp ]

      Defining a macro: [ scheme.lsp ]

      Simple test of argument binding in define: [ binding.lsp ] and in defun [ binding1.lsp ]

      Clearer examples of static binding of non-local environment with defun [ binding0.lsp ] [ binding2.lsp ]

      [ wierd.lsp ]

      Non-Functional LISP code samples

      [ do.lsp ] [ sievedo.lsp ]

      Handling Files in LISP

      [ help.lsp ] [ functions.lsp ]

      Abstract Data Types in LISP

      The defun function in LISP uses static binding of variables -- variable in defun are bound at the site of definition. Further the let construction:
       		(let ( (var value) (var value) ... ) expressions )
      creates and preserves a set of variables. In effect the let construction creates private variables that can be accesed by functions created by defun (but not XLISP define) [ classy.lsp ] This does not let us define a whole class of objects with public and private parts - but a single object with members.

      Objects in XLISP

      [ stack.lsp ] [ stack0.lsp ] [ stack2.lsp ]

      [ adts.lsp ]

      Broken code

      [ pretty.lsp ]

      Corrections to another CS320 book

      [ ch7.lsp ]

      Scheme in XLISP

      [ scheme.lsp ]

    . . . . . . . . . ( end of section Samples) <<Contents | End>>

    Laboratories

    [ lab1.html ] [ lab1.mth ]

    [ lab2.html ] [ lab2.mth ]

    [ lab3.html ] [ lab3.mth ]

    Frequently Asked Questions about LISP

    [ lisp.FAQ.01 ] [ lisp.FAQ.02 ] [ lisp.FAQ.03 ] [ lisp.FAQ.04 ] [ lisp.FAQ.05 ] [ lisp.FAQ.06 ] [ lisp.FAQ.07 ]

    Documentation

    [ lisp.html ]

    Emacs setup for LISP

    [ emacs.lisp ]

    Vi set up for LISP

    Input the following key strokes and tap return/enter in 'vi' command mode
     		:set showmatch lisp

    Source code for xlisp

    [ lisp.tar ] [ http://cse.csusb.edu/dick/cs320/lisp/src/ ]

End