From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27500 invoked by alias); 9 Mar 2015 16:37:29 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34687 Received: (qmail 27410 invoked from network); 9 Mar 2015 16:37:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=7TR/M6FYGHa/vL7r40xsNCbW83Hhyxzw6Owf0/FO2pA=; b=QeB85bb4Pxh5jW7hlXDkzqZUB9qg+tagzphM4kW26wfSVFa+eDaewnikY2ewMV0os3 lM0R89YZUATVRywyHhZ2YDW3kZ51E3NEvvMi8XdIeJA2SSBl1S3i+a+X5AjV0KFxrqXK ruRxKTnsyjtSGmCWN9Jmtc6wv7Tijfu2HQuMkfb3e+REGBjK9fTDSoEXa6k12QeoiDrJ YSfvjENQDCPGiLVABzRsbdpL/jskXmQI/HiWCCh4krXiJ4PBQl03M1Z9RB/gEb8m3jHx izfrA9YcDy56MXbP6Bemq3EYPGFgYebqymLxG0sl+dVp/cBKEx2d1SPty2+2j+op2x2x 31BA== X-Gm-Message-State: ALoCoQmLiW2RbklTw0zUYauYjQMObVhUuWVnKYMow/UMFTgO9BgLuc+tX1TYXYDdVTYfhPKjzpJo X-Received: by 10.202.207.197 with SMTP id f188mr21251166oig.29.1425919042839; Mon, 09 Mar 2015 09:37:22 -0700 (PDT) From: Bart Schaefer Message-Id: <150309093718.ZM12425@torch.brasslantern.com> Date: Mon, 9 Mar 2015 09:37:18 -0700 In-Reply-To: <20150308225336.GA2746@localhost.localdomain> Comments: In reply to Han Pingtian "Re: wrong array range with (r) flag on scalar?" (Mar 9, 6:53am) References: <20150305083000.GA3294@localhost.localdomain> <150305084408.ZM20963@torch.brasslantern.com> <20150305170638.0d10ba1b@pwslap01u.europe.root.pri> <20150308225336.GA2746@localhost.localdomain> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: wrong array range with (r) flag on scalar? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Mar 9, 6:53am, Han Pingtian wrote: } } Looks like this is also the case for (i): } } localhost% foo=abcdefgh } localhost% print $foo[(r)ab,(i)fg] } abcdefg } localhost% } } Though } } localhost% print $foo[(i)fg] } 6 } localhost% } } But according to the new contents of manual, this is the same case as } "(r)fg". You can't use (i) in ranges. $s[(i)ab,(i)fg] is an "invalid subscript"; the end of the range is not treated the same as the start. So although $s[(r)fg] is the same as $s[$s[(i)fg]], $s[(r)ab,(r)fg] is not the same as $s[$s[(i)ab],$s[(i)fg]]. The foregoing of course all applies only to indexes on scalars; for an index on an array, the pattern match and resulting index values apply to entire array elements, so there are no substrings to extract.