From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29299 invoked from network); 9 May 2022 23:46:25 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 9 May 2022 23:46:25 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1652139985; b=eUzR+l6/M8MqryDoWG5Aq6sjSqcLbrSHW3odfDTu2ZTEGEXe3N+xzx/1aX+7vw8YtuCKRnWZq5 JATjIiES7UQWHSpIKPL7CUZ+ZNF6Dh6cxk8rWCgCwv7ez9WLN05I9G/VzgVCOsqGgiaE1siiXm FZISQxoNoa42WOu5KMi0H27iMNzavGpV5BR+o5Mgwaxn+rgMgOq3jecaLs83jn8UmFwwKLekcP TLvGBeX7HoHTnhr2IFyw2Bb8DPpgB2i4vpC3xp/DkHrfYJt0fnkKo5/JFiD6bVg9mhqgKqamRQ M7/uwiAZ3I8WvtDYeDEQ4Y8fJVEfdLAcePs43OwMVYwSWA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f44.google.com) smtp.remote-ip=209.85.208.44; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1652139985; bh=yQkAg0h1px/yhaCaUHcA7aMK7YU9W/pGWn8YBzdxGMQ=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=q2o8AFnEiQ6pZ+Go7QysbFrUsN8VRv1gdjksWHjCA9pa3WU4vdWBOLXPrg97tTg0qbdiy33i4z Tiy9iypBsZNHSRbV49LV8EArjdAXnudlQpsp+O9znvZIhGOJmI5lTI0lgm0G9Hj7wam4ys0dRh zUwgtzXD2KP2X04fMOd3ovmtdibqpn6l6dgczPHT8VUneRQxzGUPYHRfuJUEgDIH1wKe9ypqlK e0DIQbVy9yM/BFN7ELgFg+RhGCphbVRGeOr4xfKWohWAA7+feqWkTZLZEbI+YEx3Xx2dU8Y+v3 rden+xMn8UMJst8AziZnpkzbhTKM43xaP1+YnDxoq1MtrA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Na5F9vaW5cI6KGNo9OoYwYpdh2GCzKEvjZ6sf78HYYI=; b=n7lftARYqpAQr8bLXlmzPolgja +/YLRBomM/idm/BBlPAVdD+ZmaITDG0TYeV5Bi/RvpNBud7GqTYk67DxyL49xmQ1ms5ZL+nGnbVF6 /ON2fWrxXfiSV0jBMbRtclnMxVDJXMppykHLS7rPwJQ4pTzM4Jwf6ue5ep2qIMOugE75/uHo73Yz8 /52M5E2O5X5ZcJEQJ2CHrI5PistsdSMYshDqy1FeVCUMmml+SQARst6puleOogltSL2vtLNKyvYu2 FC2bi3vqdP7qu3oxeAt86A5hcXV21h/d80b5je+t4yhLEwMgojDDdv8DH4QwDcHdPizLNb/qT0BPp L9kSOV2w==; Received: from authenticated user by zero.zsh.org with local id 1noD56-00001e-8D; Mon, 09 May 2022 23:46:24 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f44.google.com) smtp.remote-ip=209.85.208.44; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ed1-f44.google.com ([209.85.208.44]:41885) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1noD4E-000PJr-9R; Mon, 09 May 2022 23:45:31 +0000 Received: by mail-ed1-f44.google.com with SMTP id d6so18048532ede.8 for ; Mon, 09 May 2022 16:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Na5F9vaW5cI6KGNo9OoYwYpdh2GCzKEvjZ6sf78HYYI=; b=FEqfzR/nL+oocbSfEgKNOI+zKOhFL7ut48QZgPaXY3rBSugQLMMpJEl7afcBjwJaLk GJupJk9osxGukOCWX/NEIsBTL6fomRZahPzoXG8IHWYGq783kgsMmLfAgPQK9No6VXtZ 7xaAmUumq4aYTTYmYbrDyTZDX7NHGwVG/FpGB70Rso+RipIqq/gz01GV21LlOKJHX0+U ySLwT53Rpc6j81DQSKuT73AEbkOjWAxpdPMmlWj1+7sY7+XeX0xESRjTUVTTswN1go9y 9Kw+p7jrSpQVEd14udZzYappIeJOkAbGvNXoBey9i2Ngm/DA1+SFtKZ6RpOuVLoeOgPC GD/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Na5F9vaW5cI6KGNo9OoYwYpdh2GCzKEvjZ6sf78HYYI=; b=sl2h8q8q1vsW2wOMwDtyJcKfwJKsZx4kOCjU6vpjhEAdCuSQJftHoTMTMoFLFsdU1V vBS/G8tWw4CzXF5qrjPGdWj/4QMDitErkkUtHFPNRPMJGVtW1ZyheP/aj0CL6jB+WMmH Um8i6uYsCK2SCPgCHmbqGfGFDZ0TRR5L+zS16InHTRbREcI2m36tQj8e+jWJLNEvNBA2 dVuMzF6ai1tHFMYQot9Z8Sy/vZxLnKFmXnErc6NTwQqMQZD3Pn9iLQaD+Gxno4W5xTl9 dt42GZpCrIabrA8dK8kbED7WKv3vu36oLA9y7H4lvYuCQ6gtzdXHKDW92UBxe75AjIaa k4lA== X-Gm-Message-State: AOAM532748dqlasbawkXTFq/KJ6JMFYamq0rsnHjUYqkWyYyV7TShqHz 8ID09xOjj3NfoQPb10l4PGgofDCOAmP/vzFbSSIhfRyE0kyNHg== X-Google-Smtp-Source: ABdhPJwQD5o+G5aAa1lTOIwoaIWsE0HQ+lITAZecmMlfeFyc/PRpfjS3Pu47qkOume5W/tohZ3wKvbZ7As4i019wDkA= X-Received: by 2002:a05:6402:1111:b0:416:2ac8:b98e with SMTP id u17-20020a056402111100b004162ac8b98emr20292196edv.236.1652139929478; Mon, 09 May 2022 16:45:29 -0700 (PDT) MIME-Version: 1.0 References: <7BFD80EB-FA4C-446C-927E-FCBFDDA28246@easesoftware.com> In-Reply-To: <7BFD80EB-FA4C-446C-927E-FCBFDDA28246@easesoftware.com> From: Bart Schaefer Date: Mon, 9 May 2022 16:45:17 -0700 Message-ID: Subject: Re: Prepend to array To: Perry Smith Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 27747 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Mon, May 9, 2022 at 1:30 PM Perry Smith wrote: > > > fpath[1,0]=3D$ZDOTDIR/functions > > It does exactly what I want: it prepends $ZDOTDIR/functions to the front = of the fpath array. I can=E2=80=99t even find an example where the 2nd ind= ex is less than the first index. Hm, the documentation for "Array Element Assignment" barely mentions that you can use two comma-separated indices in an assignment at all. It's implied by "... the element or range specified by EXP is replaced ... assigning a parenthesized list of values to an element or range changes the number of elements in the array ..." The documentation is also out of date with respect to "... only single-element assignments may be made with typeset." As of the impending 5.9 release, it's probably also somewhat off when describing escaping conventions for subscripts vis-a-vis associative array assignment. > 1) Is the above syntax supported or does it just happen to work currently= ? It's supported in zsh native mode, but not in ksh_arrays or ksh_zero_subscript modes. IIRC it was introduced because of the subscripting flags that allow searching for a value, where a failed search can return an index of zero. > 2) What is the prescribed method of prepending to an array Aside from array=3D(new values $array), you found it. You can also insert new values before any individual element X with array[X,0]=3D(new values) but I don't recall if that variation is intended to remain supported.