Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
new-op
new-op
Commits
ae6d1639
Commit
ae6d1639
authored
Dec 16, 2015
by
Marco Antoniotti
💬
Browse files
Fixed doc strings for the benefit of HELambdaP.
parent
19a64ce3
Changes
1
Hide whitespace changes
Inline
Side-by-side
new-op.lisp
View file @
ae6d1639
...
...
@@ -97,21 +97,21 @@ TYPE-CONS is meant to be specialized but not called directly.
Examples:
;;; Suppose you ha
ve
;;; Suppose you ha
d
(deftype matrix (n m &optional (base-type 'double-float))
`(array ,base-type (,n ,m)))
(deftype matrix (n m &optional (base-type 'double-float))
`(array ,base-type (,n ,m)))
;;; You may want to define something along these lines.
(defmethod type-cons ((what (eql 'matrix)) spec arguments)
(destructuring-bind (n m &optional (base-type 'double-float))
spec
(assert (and (<= 0 n (1- array-dimension-limit))
(<= 0 m (1- array-dimension-limit))))
(apply #'make-array (list n m)
:element-type base-type
arguments)))
(defmethod type-cons ((what (eql 'matrix)) spec arguments)
(destructuring-bind (n m &optional (base-type 'double-float))
spec
(assert (and (<= 0 n (1- array-dimension-limit))
(<= 0 m (1- array-dimension-limit))))
(apply #'make-array (list n m)
:element-type base-type
arguments)))
"
))
...
...
@@ -203,11 +203,11 @@ system, e.g., COMPLEX and RATIONAL types with their relationship."
Calls MAKE-ARRAY after having manipulated the ARGUMENTS.
The 'bare' constructor for objects of 'type' ARRAY actually behaves
as having the following simple syntax:
new 'array &optional
<initial-contents>
&rest
<
MAKE-ARRAY
keywords
>
<pre>
new 'array &optional
INITIAL-CONTENTS
&rest MAKE-ARRAY
-
keywords
</pre>
I.e., the constructor figures out the dimensions of the
<initial-contents>
before dispatching to MAKE-ARRAY.
INITIAL-CONTENTS
before dispatching to MAKE-ARRAY.
"
(
let
((
initial-contents
(
first
arguments
)))
(
apply
#'
make-array
(
compute-data-dimensions
initial-contents
nil
t
)
...
...
@@ -249,9 +249,9 @@ Applies the function CHARACTER to the first of ARGUMENTS."
"SYMBOL Method.
The SYMBOL method has the following syntax.
NEW 'SYMBOL
S &optional (PACKAGE *PACKAGE*) COPY-PROPERTIES
<pre>
new 'symbol
S &optional (PACKAGE *PACKAGE*) COPY-PROPERTIES
</pre>
S can be a STRING or a SYMBOL. If it is a SYMBOL, S is first copied,
using COPY-SYMBOL and COPY-PROPERTIES (cfr., COPY-SYMBOL in the CL
Standard). If S is a STRING then MAKE-SYMBOL is initially called. If
...
...
@@ -410,7 +410,7 @@ The COMPLEX method applies the function COMPLEX to the arguments."
"Copies and HASH-TABLE.
This function is implementation dependent. The basic behavior
provided just copies an hash-table with the standard components."
provided
here
just copies an hash-table with the standard components."
(
declare
(
type
hash-table
ht
))
(
let
((
test
(
hash-table-test
ht
))
(
size
(
hash-table-size
ht
))
...
...
@@ -435,16 +435,18 @@ provided just copies an hash-table with the standard components."
The HASH-TABLE method admits a non-traditional syntax. It can be
invoked in two forms.
<pre>
new 'HASH-TABLE
&optional
<pairs>
&rest
<hash-table-standard-args>
&optional
PAIRS
&rest
HASH-TABLE-STANDARD-ARGS
&key &allow-other-keys
</pre>
or
<pre>
new 'HASH-TABLE
&rest
<hash-table-standard-args>
&rest
HASH-TABLE-STANDARD-ARGS
&key &allow-other-keys
</pre>
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
...
...
@@ -452,9 +454,9 @@ behaves as a 'copy' constructor. If the first of the ARGUMENTS 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, <pairs> must be an A-LIST of pairs
(
<
key
>
.
<
value
>
)
<pre>
(key . value)
</pre>
which are then fed into the newly created hash-table.
The result is an hash table.
...
...
@@ -499,16 +501,18 @@ A specialised method yielding a HASH-TABLE with BOOLEAN values.
A specialised method yielding a HASH-TABLE with BOOLEAN values. It
can be invoked in two forms.
<pre>
new 'HASH-SET
&optional
<sequence-set>
&rest
<hash-table-standard-args>
&optional
SEQUENCE-SET
&rest
HASH-TABLE-STANDARD-ARGS
&key &allow-other-keys
</pre>
or
<pre>
new 'HASH-SET
&rest
<hash-table-standard-args>
&rest
HASH-TABLE-STANDARD-ARGS
&key &allow-other-keys
</pre>
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
...
...
@@ -671,18 +675,19 @@ created."
It constructs an array after having manipulated SPEC and ARGUMENTS;
the overall effect is similar to the NEW ARRAY method.
The TYPE-CONS method allows NEW to use the following syntax:
<pre>
new '(array &optional
(
<element-type>
T)
<dimension-spec>
&rest
<
MAKE-ARRAY-kwds-1
>
(
ELEMENT-TYPE
T)
DIMENSION-SPEC
&rest MAKE-ARRAY-kwds-1
&key
&allow-other-keys)
&optional
<initial-contents>
&rest
<
MAKE-ARRAY-kwds-2
>
INITIAL-CONTENTS
&rest MAKE-ARRAY-kwds-2
&key
&allow-other-keys
</pre>
I.e., the constructor figures out the dimensions of the
<initial-contents> before dispatching to MAKE-ARRAY. Further checks
...
...
@@ -691,20 +696,20 @@ is acceptable.
MAKE-ARRAY-kwds-1 and MAKE-ARRAY-kwds-2 are the normal MAKE-ARRAY
parameters. The actual call to MAKE-ARRAY is eventually of the form:
<pre>
(apply 'make-array
<computed-dimensions>
COMPUTED-DIMENSIONS
(append
(and
<initial-contents>
(list :initial-contents
<initial-contents>
))
(and
INITIAL-CONTENTS
(list :initial-contents
INITIAL-CONTENTS
))
MAKE-ARRAY-kwd-1
MAKE-ARRAY-kwd-2))
</pre>
Therefore, order among the MAKE-ARRAY keywords is important.
It should be noted that
(array &optional (
<element-type> T) <dimension-spec>
)
<pre>
(array &optional (
ELEMENT-TYPE T) DIMENSION-SPEC
)
</pre>
is a valid, yet constrained, type specifier."
(
let
((
initial-contents
(
first
arguments
))
...
...
@@ -986,16 +991,16 @@ signalled if RANK is higher than the actual DATA rank."
It constructs a HASH-TABLE by handling a 'type specifier' with a
syntax that makes the following call the NEW possible:
(new '(hash-table &rest
ht-keys
<pre>
(new '(hash-table &rest
HT-KEYS
&key
(
test
#'eql)
(
size
(hash-table-size *default-dummy-hash-table*))
(
rehash-size
(hash-table-rehash-size *default-dummy-hash-table*))
(
rehash-threshold
(hash-table-rehash-threshold *default-dummy-hash-table*))
(
TEST
#'eql)
(
SIZE
(hash-table-size *default-dummy-hash-table*))
(
REHASH-SIZE
(hash-table-rehash-size *default-dummy-hash-table*))
(
REHASH-THRESHOLD
(hash-table-rehash-threshold *default-dummy-hash-table*))
&allow-other-keys)
&rest arguments)
</pre>
The defaults for each of the keyword arguments are implementation dependent.
"
(
destructuring-bind
(
&rest
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment