From 8afd3f7ed5980d5ee04a41601b21f910e3e46bf5 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 31 Jan 2018 06:10:12 -0800 Subject: doc: more detail in ref/refset re: structs. * txr.1: Describe fallback of ref and refset onto list-like operations if lambda/lambda-set are not supported. --- txr.1 | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/txr.1 b/txr.1 index 71c96fbc..aeeee908 100644 --- a/txr.1 +++ b/txr.1 @@ -26727,19 +26727,46 @@ If .meta seq is a structure, it supports .code ref -if it has a +directly if it has a .code lambda method. The .meta index argument is passed to that method, and the resulting value is -returned. Similarly, a structure supports +returned. +If a structure lacks a +.code lambda +method, but has a +.code car +method, then +.code ref +treats it as a list, traversing the structure using +.cod3 car / cdr +operations. In the absence of support for these operations, +the function fails with an error exception. + +Similarly, a structure supports .code refset -if it has a +directly if it has a .code lambda-set -method, which is called with +method. This gets called with .meta index and -.metn new-value . +.meta new-value +as arguments. Then +.meta new-value +is returned. +If a structure lacks a +.code lambda-set +method, then +.code refset +treats it as a list, traversing the structure using +.cod3 car / cdr +operations, and storing +.meta new-value +using +.codn rplaca . +In the absence of support for these operations, +the function fails with an error exception. The .code ref -- cgit v1.2.3