readable/man/sweet-clisp.1
2013-08-19 18:13:04 -04:00

159 lines
5.1 KiB
Groff

.TH UNSWEETEN 1 local
.SH NAME
sweet-clisp \- Run clisp using sweet-expressions
.SH SYNOPSIS
.ll +8
.B sweet-clisp [clisp-options [-CREPL]] [FILE.slisp [args]]
.ll -8
.br
.SH DESCRIPTION
.PP
.I sweet-clisp
runs the Common Lisp "clisp" implementation,
and enables "sweet-expressions" in its reader.
If given a filename, it will run that file (expressed using sweet-expressions);
a file name of "-" means the standard input.
If no file is given, then an interactive mode is enabled
(normally this means that the clisp REPL is run with readline enabled).
.PP
Note that it will execute (using clisp) each sweet-expression in turn.
If given a file, it will not normally display the results of each
expression.
If you want a result displayed, use functions that do so such as
"print", "princ", "write", and so on.
.PP
It accepts clisp-options (which begin with "-").
To execute a filename, make sure it does not begin with "-"
(e.g., prefix it with "./").
.PP
This program, by default, works around a bug in the clisp standard REPL.
Without the workaround, in the clisp standard REPL any
top-level sweet-expressions that are not initially indented
must be separated by a blank line.
If they aren't separated, then the first line of the second
sweet-expression would be skipped (they are consumed by the REPL reader).
Note that this bug does not affect files run by clisp,
re-implementations of the REPL on clisp, or other Common Lisp
implementations (e.g., SBCL doesn't have this problem).
The work-around overrides some system function definitions when the
REPL is invoked, and triggers some warnings that look like this:
WARNING: DEFUN/DEFMACRO: redefining function
|SYSTEM|::|READ-FORM| in top-level, was defined in C
WARNING: DEFUN/DEFMACRO: redefining function
|SYSTEM|::|READ-EVAL-PRINT| in top-level, was defined in C
.PP
If you do not want the work-around performed, use the
"-CREPL" option, which forces this program to use the
standard clisp REPL (without a work-around) instead.
.PP
The clisp program notices that this overrides the reader, and as
a "safety" measure it normally displays all symbols
with vertical bars around them.
This is not required or even suggested by the Common Lisp specification,
but it technically is consistent with it.
Unfortunately, this produces technically-correct but ugly symbol displays.
To work around this, sweet-clisp sets *print-escape* to false.
This makes the symbols look nicer, but it does create some ambiguities,
and it means that keywords are not printed with a leading colon character.
If you do not like this, then set *print-escape* to true:
setq *print-escape* t
.PP
This command uses whatever version of the "readable" library that asdf finds.
You can override the usual readable library location by setting
the asdf environment variable CL_SOURCE_REGISTRY.
For example:
CL_SOURCE_REGISTRY="$PWD" ./sweet-clisp ...
.PP
This command requires clisp, and it also requires
that asdf be set up properly for clisp.
.PP
The
.I sweet-clisp
program is primarily intended for interactive use.
If you're writing Common Lisp code in files, it is more portable
to instead create ordinary ".lisp" files, and begin them early with:
(require "asdf")
(asdf:load-system :readable)
(readable:enable-sweet)
.PP
For maximum portability, you should also end each such file with:
(readable:disable-readable)
.PP
For more information, see
http://readable.sourceforge.net.
.SH OPTIONS
.PP
See clisp(1).
A particularly useful option is -modern.
.\" .SH "ENVIRONMENT"
.\" .PP
.\" .SH BUGS
.\" .PP
.SH EXAMPLES
.PP
An example use might be the following:
sweet-clisp f.slisp
.PP
The file f.slisp would be executed; it might contain:
defun fact (x)
if {x < 1}
1
{x * fact{x - 1}}
princ fact(5)
.PP
If f.slisp does contain this, then "120" should be displayed.
.SH "SEE ALSO"
.PP
.IR sweeten(1) ,
.IR unsweeten(1) .
.SH "COPYRIGHT NOTICE"
.PP
Copyright \(co 2013 David A. Wheeler
.PP
This software (including the documentation)
is released as open source software under the "MIT" license:
.PP
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
.PP
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
.PP
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
.PP
However, small portions of the sweet-clisp program are actually
under the GNU GPLv2 license; see the file for details.