Commit 89db285e authored by Marco Antoniotti's avatar Marco Antoniotti 💬

Files removed.

parent ae6d1639
NEW-OP
======
NEW OP is a small library that introduces a unified "constructor"
operator. The operator is called "new" and it can be used to create
any Common Lisp object starting from a type description.
Copyright (c) 2010-2015 Marco Antoniotti
All rights reserved.
See the file COPYING for license information.
/*
* CL EXT STYLE
*
* Inspired by www.rhythmbox.org, (c) rhythmbox 2002
*
* New code, modifications
* (c) Idan Gazit 2002, and
* (c) Marco Antoniotti, 2003-2009
*
* Permission is hereby granted to use this style, etc etc etc.
*/
/* body styles. */
body {
/* margin: 0; */
background: #ffffff;
font-family: Verdana, Arial, Helvetica;
font-weight: normal;
font-size: 12px;
color: black;
}
/* A element styles. */
a.navigation-link-selected {
text-decoration: none;
color: #ffffff;
font-weight: normal;
font-style: italic;
}
a.navigation-link-selected:hover {
text-decoration: underline;
color: #ffffff;
font-weight: normal;
font-style: italic;
}
a.navigation-link {
text-decoration: none;
color: rgb(100, 100, 100);
font-weight: normal;
}
a.navigation-link:hover {
text-decoration: underline;
color: #ffffff;
font-weight: normal;
}
a.return {
text-decoration: none;
color: #41286f;
font-size: 8pt;
font-weight: normal;
}
a.return:hover {
text-decoration: underline;
color: #68548D;
font-size: 8pt;
font-weight: normal;
}
a {
text-decoration: underline;
color: #41286f;
}
a:hover {
text-decoration: underline;
color: #68548D;
}
/* P element styles. */
p {
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: #000000;
font-weight: normal;
}
/* Element-independent class styles. */
.header {
background: #9ebcb4;
/* background-image: url("./images/header_bg_1.gif"); */
/* background-repeat: no-repeat; */
height: 55px;
}
.navigation {
word-spacing: 5px;
position: absolute;
top: 35px;
right: 5px;
text-align: right;
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: #ffffff;
font-weight: normal;
word-spacing: 0px;
}
.sidebar {
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: #000000;
font-weight: normal;
padding-left: 15px;
padding-right: 5px;
position: fixed;
top: 10ex;
right: 1em;
}
.text {
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: #000000;
font-weight: normal;
margin-left: 5cm;
margin-right: 2em;
}
.label {
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: #000000;
text-align: center;
font-style: italic;
}
.command {
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: #000000;
background: #eae8e3;
font-weight: normal;
margin-bottom: 10px;
}
.content {
background: #ffffff;
padding: 5px;
padding-right: 15px;
}
.toc {
font-size: 10px;
background: #ffffff;
padding: 5px;
padding-right: 5px;
}
.middle-bar {
height: 5px;
background: #A497BA;
}
.black-line {
height: 1px;
background: #000000;
}
.bottom {
position: absolute;
right: 5px;
bottom: 5px;
}
.copyright {
font-family: Verdana, Arial, Helvetica;
font-size: 10px;
color: #808080;
font-weight: normal;
padding: 5px;
text-align: right;
border-color: #808080;
border-width: 0px;
border-style: dotted;
border-top-width: 1px;
}
.centerblock {
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: black;
font-weight: normal;
}
.tableheader {
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: white;
font-weight: bold;
background: #505050;
padding: 4px;
}
.tablerow1 {
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: black;
font-weight: normal;
background: #e0e0e0;
padding: 4px;
}
.tablerow2 {
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: black;
font-weight: normal;
background: #f0f0f0;
padding: 4px;
}
.tablerow_style {
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: black;
font-weight: normal;
background: #f0f0f0;
padding: 4px;
}
.captionimg {
text-align: right;
font-style: italic;
font-weight: normal;
font-size: 10px;
color: #303030;
}
.indent {
padding-left: 50px;
}
/*
.command
{
font-family: Courier;
}
*/
/* LI element style. */
li {
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: #000000;
font-weight: normal;
}
/* PRE element style. */
pre {
background-color: #e0e0e0;
}
/* H elements styles. */
h1 {
font-family: Verdana, Arial, Helvetica;
font-size: 18px;
color: #41286f;
font-weight: bold;
}
h2 {
font-family: Verdana, Arial, Helvetica;
font-size: 16px;
color: #41286f;
font-weight: bold;
}
h3 {
font-family: Verdana, Arial, Helvetica;
font-size: 14px;
color: #41286f;
font-weight: bold;
}
h4 {
font-family: Verdana, Arial, Helvetica;
font-size: 12px;
color: #41286f;
font-weight: bold;
}
h5 {
font-family: Verdana, Arial, Helvetica;
font-size: 10px;
color: #41286f;
font-weight: bold;
}
/* Floating menu to the right */
#menu {
position: fixed;
top: 2cm;
max-width: 4cm;
padding-left: 2em;
}
/* end of file -- clstyle.css -- */
<!-- blank.html -->
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<body>
</body>
</html>
<!-- end of file : blank.html -->
<!-- dictionary-frame.html -->
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>NEW Dictionary</title>
<link rel="stylesheet" href="../clstyle.css">
</head>
<frameset rows="65px,*" frameborder=0 noresize="noresize">
<frame src="dictionary-header.html" />
<frameset cols="20%,*" frameborder=0>
<frameset rows="20%,80%" frameborder=0 noresize="noresize">
<frame src="dictionary-navigation.html" />
<!-- <frame src="dictionary-list.html" name="Dictionary_entries" /> -->
<frame src="blank.html" name="Dictionary_entries" />
</frameset>
<frame src="dictionary.html" name="Dictionary_frame" />
</frameset>
<noframes>
<h2>Frame Alert</h2>
<p>
This document is designed to be viewed using the frames feature. If
you see this message, you are using a non-frame-capable web client.
<br>
Link to<a href="overview-summary.html">Non-frame version.</a>
</noframes>
</frameset>
</html>
<!-- end of file : dictionary-frame.html -->
<!-- dictionary-list.html -->
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>NEW Entries</title>
<link rel="stylesheet" href="../clstyle.css">
</head>
<body>
<h4>Functions</h4>
<ul>
<li><a href="new-op-function.html" target="Dictionary_frame">new</a></li>
<li><a href="type-cons-function.html" target="Dictionary_frame">type-cons</a></li>
<li><a href="register-structure-constructor-function.html" target="Dictionary_frame">register-structure-constructor</a></li>
</ul>
<h4>Macros</h4>
<ul>
<li><a href="newq-macro.html" target="Dictionary_frame">newq</a></li>
</ul>
<!--
;;; Copyright (c) 2010, 2011 Marco Antoniotti, All rigths reserved.
;;;
;;; Permission to use, modify, and redistribute this code is hereby
;;; granted.
;;; The code is provided AS IS with NO warranty whatsoever. The author
;;; will not be held liable etc etc etc etc etc.
-->
</body>
</html>
<!-- end of file : dictionary-list.html -->
<!-- new-op-function.html -->
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>NEW: Generic Function NEW</title>
<link rel="stylesheet" href="../clstyle.css">
</head>
<body>
<h1><i>Generic Function</i> <strong>new</strong></h1>
<h2>Package:</h2>
<p><code><a href="new-op-package.html">NEW-OP</a></code></p>
<h2>Syntax:</h2>
<p>
<pre>
<b>new</b> <i>type</i> &amp;rest <i>arguments</i>
&rArr; <i>result</i>
</pre>
</p>
<h3>Arguments and Values:</h3>
<p><i><code>type</code></i>--a <strong>CL</strong> <em>type specifier</em>.</p>
<p><i><code>arguments</code></i>---a list of arguments to be used by
the methods; evaluated.
<p><i><code>result</code></i>---a an <em>object</em> of type <i><code>type</code></i>.</p>
<h2>Description:</h2>
<p>The NEW generic function is a single entry point for MAKE-INSTANCE,
DEFSTRUCT and other constructors, e.g., for HASH-TABLEs and ARRAYs.</p>
<p>Methods for NEW can be defined specialized for new classes.
Structure classes need to register their constuctor; see
REGISTER-STRUCTURE-CONSTRUCTOR. Compound type specifiers must be
specialized by defining methods for TYPE-CONS.
</p>
<h2>Known Methods:</h2>
<p>The following are the known methods for the generic function
<code>new</code>.
<ul>
<li><p>
<pre>
<b>new</b> (<i>s</i> symbol) &amp;rest <i>arguments</i>
&rArr; <i>result</i>
</pre>
</p>
<p>Dispatches on the class named by the argument <code><i>s</i></code>.</p>
</li>
<li><p>
<pre>
<b>new</b> (<i>s</i> standard-class) &amp;rest <i>arguments</i>
&rArr; <i>result</i>
</pre>
</p>
<p>Applies MAKE-INSTANCE to the class <i><code>s</code></i> and
<i><code>arguments</code></i> (which may include all the
<code>:initarg</code>s defined for <i><code>s</code></i>). This
method is, to all effects, MAKE-INSTANCE in disguise.
</p>
</li>
<li><p>
<pre>
<b>new</b> (<i>s</i> structure-class) &amp;rest <i>arguments</i>
&rArr; <i>result</i>
</pre>
</p>
<p>Applies the constructor of the STRUCTURE-CLASS
<i><code>s</code></i> to the <i><code>arguments</code></i>. The
constructor must have been registered with
REGISTER-STRUCTURE-CONSTRUCTOR to be applicable.
</p>
</li>
<li><p>
<pre>
<b>new</b> (<i>s</i> builtin-class) &amp;rest <i>arguments</i>
&rArr; <i>result</i>
</pre>
</p>
<p>Signals an 'undefined' error. This method is a sink for the
built-in classes which do not have a specialized method built with
EQL specializers.
</p>
</li>
<li><p>
<pre>
<b>new</b> (<i>cts</i> cons) &amp;rest <i>arguments</i>
&rArr; <i>result</i>
</pre>
</p>
<p>This is the method that handles the compound type specifiers. It
eventually calls <code>type-cons</code>, which is in charge of dealing with each
compound type specifier.</p>
In order to inform the <code>new</code> operator of a new compound type specifier
it is thus sufficient to define an appropriate <code>type-cons</code> method.
</p>
</li>
</ul>
</p>
<p>The following are (some) of the known EQL specialized methods.</p>
<ul>
<li><p>
<pre>
<b>new</b> (<i>s</i> (eql (find-class 'array))) &amp;rest <i>arguments</i>
&rArr; <i>result</i>
</pre>
</p>
<p>Calls MAKE-ARRAY after having manipulated the ARGUMENTS.
The 'bare' constructor for objects of 'type' ARRAY actually behaves
as having the following simple syntax:</p>
<p>
<pre>
<b>new</b> 'array &optional <i>initial-contents</i> &rest <i>&lt;MAKE-ARRAY keyword argumentss&gt;</i>
</pre>
</p>
<p>I.e., the constructor figures out the dimensions of the
<i><code>initial-contents</code></i> before dispatching to MAKE-ARRAY.</p>
</li>
<li><p>
<pre>
<b>new</b> (<i>s</i> (eql (find-class 'symbol))) &amp;rest <i>arguments</i>
&rArr; <i>result</i>
</pre>
</p>
<p>The SYMBOL method works with the following syntax.</p>
<p>
<pre>
<b>new</b> 'symbol <i>s</i> &optional (<i>package</i> *package*) <i>copy-properties</i>
</pre>
</p>
<p><i><code>s</code></i> can be a STRING or a SYMBOL. If it is a
SYMBOL, <i><code>s</code></i> is first copied, using COPY-SYMBOL and
<i><code>copy-properties</code></i> (cfr., COPY-SYMBOL in the CL
standard). If <i><code>s</code></i> is a STRING then MAKE-SYMBOL is
initially called. If <i><code>copy-properties</code></i> is NIL then
a fresh, uninterned symbol is returned, otherwise the resulting
symbol is IMPORTed in PACKAGE.
</p>
</li>
<li><p>
<pre>
<b>new</b> (<i>s</i> (eql (find-class 'hash-table))) &amp;rest <i>arguments</i>
&rArr; <i>result</i>
</pre>
</p>
<p>The HASH-TABLE method admits a non-traditional syntax. It can be
invoked in two forms.</p>
<p>
<pre>
<b>new</b> 'hash-table
&optional <i>pairs</i>
&rest <i>&lt;hash-table standard keyword arguments&gt;</i>
&key &allow-other-keys
</pre>
or
<pre>
<b>new</b> 'hash-table
&rest <i>&lt;hash-table standard keyword arguments&gt;</i>
&key &allow-other-keys
</pre>
</p>
<p>I.e., it dispatches on the first of the <i><code>arguments</code></i> to decide whether it
also has to 'fill' the newly created hash table; in this last case, it
behaves as a 'copy' constructor. If the first of the <i><code>arguments</code></i> is a
HASH-TABLE, the keywords are ignored. If it is a keyword then it is
assumed that the call must resolve to a simple call to
MAKE-HASH-TABLE. Otherwise, <i><code>pairs</code></i> must be an
A-LIST of pairs
<pre>
(&lt;key&gt; . &lt;value&gt;)</pre>
which are then fed into the newly created hash-table.
</p>
<p>
The <i><code>result</code></i> is a hash table.
</p>
</li>
<li><p>
<pre>
<b>new</b> (<i>s</i> (eql 'hash-set)) &amp;rest <i>arguments</i>
&rArr; <i>result</i>
</pre>
</p>
<p>A specialised method yielding a HASH-TABLE with BOOLEAN values. It
can be invoked in two forms.</p>
<p>
<pre>
<b>new</b> 'hash-set
&optional <i>sequence-set</i>
&rest <i>&lt;hash-table standard keyword arguments&gt;</i>
&key &allow-other-keys
</pre>
or
<pre>
<b>new</b> 'hash-set
&rest <i>&lt;hash-table standard keyword arguments&gt;</i>
&key &allow-other-keys
</pre>
</p>
<p>I.e., it dispatches on the first of the ARGUMENTS to decide whether it
also has to 'fill' the newly created hash table; in this last case, it
behaves as a 'copy' constructor for the hash-table skeleton, and then
it substitutes the values or the resulting hash-table with T. If the
first of the <i><code>arguments</code></i> is a hash-table, the
keywords are ignored. If it is a keyword then it is assumed that the
call must resolve to a simple call to MAKE-HASH-TABLE. Otherwise,
<i><code>sequence-set</code></i> must be a SEQUENCE of elements of
the set.</p>
<p>The <i><code>result</code></i> is an hash table.</p>
</li>
</ul>
<h2>Examples:</h2>
<p>Using the NEW-OP package.
<pre>
CL-prompt&gt; <b>(<span style="color: red">new</span> 'vector 0 1 2 3 4)</b>
<i>#(0 1 2 3 4)</i>
CL-prompt&gt; <b>(<span style="color: red">new</span> 'list 'foo 'bar 'baz))</b>
<i>(FOO BAR BAZ)</i>
CL-prompt&gt; <b>(defclass zot () ((s :initarg :s)))</b>
<i>#&lt;STANDARD-CLASS ZOT 200CFF83&gt;</i>
CL-prompt&gt; <b>(describe (<span style="color: red">new</span> 'zot :s 42))</b>
#&lt;ZOT 21629E07&gt; is a ZOT
S 42
CL-prompt&gt; <b>(<span style="color: red">new</span> <span
style="color: blue">'(array single-float (2 2))</span> '((1.0 0.0) (0.0 1.0)))</b>
<i>#2A((1.0 0.0) (0.0 1.0))</i>