summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-06-01 20:57:01 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-06-01 20:57:01 -0700
commitb0ae3c5e66313a7f58d346a55c80df355b63c559 (patch)
tree83da9651ebcfcf6f516d2138225e2e22e2e915ec /txr.1
parent7bfad97bfbcfea8c6e500565a629341419471013 (diff)
downloadtxr-b0ae3c5e66313a7f58d346a55c80df355b63c559.tar.gz
txr-b0ae3c5e66313a7f58d346a55c80df355b63c559.tar.bz2
txr-b0ae3c5e66313a7f58d346a55c80df355b63c559.zip
Adding special function from-list.
* lib.c (from_list_s): New symbol variable. (make_like): Handle a COBJ. If it's a structure with a from-list method, then use it, otherwise the default handling applies of returning the list. (obj_init): Initialize from_list_s. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.142
1 files changed, 42 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 00e15ca5..5a2e79ae 100644
--- a/txr.1
+++ b/txr.1
@@ -21113,6 +21113,48 @@ method should return
if the object is considered to denote an empty sequence. Otherwise it
should return that object itself.
+.SS Function @ from-list
+.synb
+.mets << object .[from-list << list ]
+.syne
+.desc
+If a
+.code from-list
+structure function is defined for a structure type, it is called in certain
+situations with an argument which is a list object. The function's purpose
+is to construct a new instance of the structure type, derived from that
+list.
+
+Note: the
+.code from-list
+function isn't a method; it doesn't receive
+.meta object
+as an argument. In the style of call depicted by the syntax description
+above,
+.meta object
+is used to identify the structure type whose
+.meta from-list
+static slot provides the function definition.
+
+The purpose of this function is to allow sequence processing operations
+such as
+.code mapcar
+and
+.code remove
+to operate on a structure object as if it were a sequence, and return a
+transformed sequence of the same type. This is analogous to the way such
+functions can operate on a vector or string, and return a vector or string.
+
+If a structure object behaves as a sequence thanks to providing
+.codn car ,
+.code cdr
+and
+.code nullify
+methods, but does not have a
+.code from-list
+function, then those sequence-processing operations which return a sequence
+will always return a plain list of items.
+
.SS* Sequence Manipulation
.coNP Function @ seqp
.synb