From 19fb18a343d88621ebab989539a3463b1ffbba7d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 24 Jan 2017 10:44:10 -0800 Subject: New memp function for searching a plist. * eval.c (eval_init): Register memp intrinsic. * lib.c (memp): New function. * lib.h (memp): Declared. * txr.1: Documented. --- txr.1 | 48 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index dd7b816e..198cca4b 100644 --- a/txr.1 +++ b/txr.1 @@ -18184,16 +18184,16 @@ function applied to the corresponding element of the input list. .SS* Property Lists -.coNP Function @ prop -.synb -.mets (prop < plist << key ) -.syne -.desc A property list a flat list of even length consisting of interleaved pairs of property names (usually symbols) and their values (arbitrary objects). An example property list is (:a 1 :b "two") which contains two properties, :a having value 1, and :b having value "two". +.coNP Function @ prop +.synb +.mets (prop < plist << key ) +.syne +.desc The .code prop function searches property list @@ -18211,6 +18211,44 @@ found, or due to the property being present with a .code nil value. +The indicators in +.meta plist +are compared with +.meta key +using +.code eq +equality, allowing them to be symbols, characters or +.code fixnum +integers. + +.coNP Function @ memp +.synb +.mets (memp < key << plist ) +.syne +.desc +The +.code memp +function searches property list +.meta plist +for key +.metn key , +using +.code eq +equality. + +If the key is found, then the entire suffix of +.meta plist +beginning with the indicator is returned, such that the first +element of the returned list is +.meta key +and the second element is the property value. + +Note the reversed argument convention relative to the +.code prop +function, harmonizing with functions in the +.code member +family. + .SS* List Sorting Note: these functions operate on lists. The principal sorting function -- cgit v1.2.3