From 1c37de6f45dd9f383c9a52e937344c604340f436 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 15 Nov 2017 06:56:09 -0800 Subject: rfind-if: optimized rewrite and hash support. * lib.c (rfind_if): Function rewritten to use the seq_info sequence classification mechanism, for much better performance on vector-like objects. Also, supports hash tables just like find_if. * txr.1: Documentation updated regarding hash support of rfind-if. --- txr.1 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index d7f3ad91..26bc2051 100644 --- a/txr.1 +++ b/txr.1 @@ -27491,7 +27491,7 @@ then these cells are taken as their keys. .coNP Functions @ rfind and @ rfind-if .synb .mets (rfind < key < sequence >> [ testfun <> [ keyfun ]]) -.mets (rfind-if < predfun < sequence <> [ keyfun ]) +.mets (rfind-if < predfun >> { sequence | << hash } <> [ keyfun ]) .syne .desc The @@ -27509,6 +27509,18 @@ in they return the right-most element rather than the leftmost. +In the case of +.code rfind-if +when a +.meta hash +is specified instead of a +.metn sequence , +the function searches through the hash entries in the same order as +.codn find-if , +but finds the last match rather than the first. +Note: hashes are inherently not ordered; the relative order of items in +a hash table can change when other items are inserted or deleted. + .coNP Functions @ find-max and @ find-min .synb .mets (find-max >> { sequence | << hash } >> [ testfun <> [ keyfun ]]) -- cgit v1.2.3