home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / pseudo-s / readme < prev   
Encoding:
Text File  |  1993-07-16  |  6.9 KB  |  198 lines

  1. -*- Mode: Text; -*-
  2.  
  3. File README / Copyright (c) 1991 Jonathan Rees / See file COPYING
  4.  
  5. This is Pseudoscheme, developed by Jonathan Rees at the MIT AI Lab and
  6. the Cornell Robotics and Vision Laboratory (jar@altdorf.ai.mit.edu,
  7. jar@cs.cornell.edu).
  8.  
  9. Send mail to info-clscheme-request@mc.lcs.mit.edu to be put on a
  10. mailing list for announcements.
  11.  
  12. See the end of this file for differences between version 2.7 and
  13. version 2.8.
  14. ----------
  15.  
  16. Here is some documentation.
  17.  
  18.  
  19. INSTALLATION.
  20.  
  21. This version (version 2.8) of Pseudoscheme was developed using Sun
  22. (Lucid) Common Lisp.  Earlier versions of Pseudoscheme have been
  23. tested in Symbolics CL, VAX LISP under VMS, Explorer CL, and a few
  24. other Common Lisps.  If you're installing Pseudoscheme in some other
  25. version of Common Lisp, you may have to customize a few things:
  26.   - edit the definitions of SOURCE-FILE-TYPE and OBJECT-FILE-TYPE
  27.     in "clever.lisp" as appropriate;
  28.   - edit the definition of PREFERRED-CASE in "loadit.lisp" as appropriate
  29.     for your file system;
  30.   - rename file "clever.lisp" if necessary so that your Common Lisp's LOAD
  31.     can find it given just the name "clever".
  32. Please send your customizations to jar@altdorf.ai.mit.edu so that they
  33. can be distributed to other users.
  34.  
  35.  
  36. RUNNING PSEUDOSCHEME.
  37.  
  38. To load Pseudoscheme into a Common Lisp system, first load the file
  39. "loadit.lisp", then do
  40.  
  41.     (schi:loadit "<dir>")
  42.  
  43. where <dir> is the directory in which Pseudoscheme is located.  Under
  44. Unix, <dir> should include a final /, e.g. "/u/gjs/pseudo/".  The
  45. first time the system is loaded, it will compile itself.
  46.  
  47. Once the system is loaded, enter Scheme with
  48.  
  49.     (schi:scheme)
  50.  
  51. and leave Scheme with
  52.  
  53.     (quit)
  54.  
  55. There are definitions for everything that's in the Revised^4 Report on
  56. the Algorithmic Language Scheme, although some definitions are
  57. incomplete or approximate.  See under "limitations," below.
  58.  
  59. If you are using a Symbolics system, the first line of every Scheme source
  60. file should be the following:
  61.  
  62.     ;-*- Mode: Scheme; Syntax: Scheme; Package: Scheme; -*-
  63.  
  64.  
  65. EXTENSIONS.
  66.  
  67. The following nonstandard procedures are defined:
  68.  
  69.     quit              - leaves Scheme.
  70.     compile-file      - compiles a file of Scheme code.  Arguments are as
  71.             in Common Lisp's compile-file function.
  72.     compile           - compiles one procedure, like Common Lisp's
  73.             compile function.
  74.     translate-file    - translates a file of Scheme code into Common Lisp.
  75.             Output is written to a file with type ".pso"
  76.             ("Pseudoscheme output").
  77.     pp                - prints something with
  78.               (let ((lisp:*print-pretty* t)) ...). 
  79.     error             - signals an error.  Compatible with T, MIT Scheme,
  80.                 and Common Lisp.
  81.     benchmark-mode    - cause Revised^4 Scheme primitives to be
  82.             inlined.  Analogous to (declare (usual-integrations))
  83.             in MIT Scheme.
  84.  
  85. If you need an EVAL procedure, try this:
  86.  
  87.     (define eval #'schi:scheme-eval)
  88.     (define scheme-user-environment schi:scheme-user-environment)
  89.     (eval '((lambda (x) (+ x 2)) 1)
  90.       scheme-user-environment)    =>  3
  91.  
  92. The implementation supports macros (define-syntax), but I haven't
  93. written any practical documentation yet.  The principles are outlined
  94. in the paper "Macros That Work", by Clinger and Rees, in the
  95. proceedings of the 1991 Symposium on Principles of Programming
  96. Languages.  Example:
  97.  
  98.     (define-syntax cons-stream
  99.       (lambda (exp rename compare)
  100.     '(,(rename 'cons) ,(cadr exp) (,(rename 'delay) ,(caddr exp)))))
  101.  
  102. which is roughly equivalent to
  103.  
  104.     (define-syntax cons-stream
  105.       (syntax-rules ()
  106.         ((cons-stream head tail)
  107.      (cons head (delay tail)))))
  108.  
  109. There are other useful features internally, notably a record package
  110. and a rudimentary module system.  These are currently undocumented.
  111.  
  112.  
  113. LIMITATIONS.
  114.  
  115. Tail recursion will work for ordinary loops written using LETREC,
  116. internal DEFINE, and named LET; in other cases, however, you will have
  117. true tail recursion only if the underlying Common Lisp supports it.
  118.  
  119. CALL-WITH-CURRENT-CONTINUATION is implemented using Common Lisp BLOCK
  120. and is therefore not as general as in a true Scheme.
  121.  
  122. Arithmetic is Common Lisp's, not Scheme's, so the exact/inexact
  123. distinction isn't implemented quite right.
  124.  
  125. Identifiers beginning with & may produce warnings or not work when
  126. running under some Common Lisp implementations.  E.g. Lucid will say
  127. "Error: (&FOO) is an ill-formed lambda-list" for (lambda (&foo) &foo).
  128.  
  129. The Common Lisp reader rejects the identifier "...".
  130.  
  131. Certain Common Lisp implementations implement some instances of the
  132. Lisp FUNCTION type as conses; in this case, the PAIR? procedure may
  133. return #T for some procedures.
  134.  
  135. The WRITE procedure will generate incorrect output for structures
  136. containing #T, #F, and ().
  137.  
  138.  
  139. INTERACTION BETWEEN SCHEME AND COMMON LISP.
  140.  
  141. You can generally call Common Lisp functions from Scheme programs by
  142. using package prefixes, e.g.
  143.  
  144.     (define (openit)
  145.       (lisp:open "foo.txt" :direction :output))
  146.  
  147. Most data types correspond closely: Scheme pairs are Lisp conses,
  148. procedures are functions, ports are streams, etc.  The main difference
  149. is that Scheme boolean false (#F) is different from Lisp boolean false
  150. (NIL).  You should therefore beware of any use of booleans in calls
  151. out to Common Lisp.  The functions SCHI:TRUE? and SCHI:TRUEP can be
  152. used to handle coercions between the two: SCHI:TRUE? turns LISP:NIL
  153. into #F, and SCHI:TRUEP turns #F into LISP:NIL.
  154.  
  155. Common Lisp special forms and macros may or may not work in Scheme
  156. code, because of the variable renaming that Pseudoscheme performs and
  157. its implicit insertion of FUNCALL's and SPECIAL declarations.  Usually
  158. a special form works if it has the syntax of a function call (as do
  159. e.g.  LISP:UNWIND-PROTECT or LISP:CATCH).  If you need to know, you
  160. can see what the translator does by doing (LISP:MACROEXPAND
  161. '<scheme-expression>).
  162.  
  163. You can do Common Lisp special binding from Scheme code using LET or
  164. LAMBDA if the variable is not in the SCHEME package and the variable is
  165. proclaimed special, e.g.
  166.  
  167.     (let ((lisp:*print-level* 10)) ...)
  168.  
  169. While Scheme is running, *PACKAGE* is ordinarily bound to the SCHEME
  170. package.
  171.  
  172.  
  173. REBUILDING THE TRANSLATOR.
  174.  
  175. To rebuild the translator (.pso files) from sources (the .scm files),
  176. follow the directions at the top of file bootit.scm.
  177.  
  178.  
  179. NEW IN VERSION 2.8.
  180.  
  181. - #F and () are distinct values.  Among other things, this means that
  182.   (null? #f) and (not '()) are now #f instead of #t.
  183.  
  184. - The dialect supported is Revised^3.99 Scheme, not Revised^3 Scheme.
  185.   This means that a few things have gone away (T, NIL, LAST-PAIR), a
  186.   few things have changed (arguments to NUMBER->STRING and
  187.   STRING->NUMBER), and there are a few new features (PEEK-CHAR,
  188.   LIST?).
  189.  
  190. - As required by the Scheme report, the built-in Scheme procedures are
  191.   not integrated by default.  This means that you can SET! or DEFINE
  192.   any name (except for the syntactic keywords).  It also means,
  193.   however, that programs will run more slowly than would have under
  194.   version 2.7.  To obtain better performance, evaluate
  195.   (benchmark-mode).
  196.  
  197. - define-syntax and syntax-rules, as not described above.
  198.