From 54e007f7e7f71bf93d9744c2c668c61a68b54d46 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 25 Jan 2018 15:28:34 -0800 Subject: doc: some clarifications about dwim brackets. txr.1: The equivalences between [x i] and some functions like ref are dynamic; they depend not only on the type ofx, but also whether i is a range or integer. --- txr.1 | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index a53fac35..1ba40a4d 100644 --- a/txr.1 +++ b/txr.1 @@ -22176,17 +22176,20 @@ argument must be a modifiable string. Direct use of .code chr-str -is equivalent to the DWIM bracket notation except -that +is equivalent to the DWIM bracket notation provided that .meta str -must be a string. The following relation holds: +is a string and +.meta idx +an integer. The following relation holds: .cblk (chr-str-set s i c) --> (set [s i] c) .cble -since -.codn "(set [s i] c) <--> (refset s i c)" , +Since +.code "(set [s i] c) <--> (refset s i c)" +for an integer index +.codn i , this also holds: .cblk @@ -26786,7 +26789,11 @@ The following equivalences hold between .code ref and .codn refset , -and the DWIM bracket syntax: +and the DWIM bracket syntax, provided that +.meta idx +is a scalar index and +.meta seq +is a sequence object, rather than a hash. .cblk (ref seq idx) <--> [seq idx] -- cgit v1.2.3