Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID
	autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=brasslantern-com.20150623.gappssmtp.com; s=20150623;
        h=from:message-id:date:in-reply-to:comments:references:to:subject
         :mime-version:content-type;
        bh=xL8z9J/3+LN2qtPBRHUBTKylPHW3dT7jBqrWtEG6XNg=;
        b=if4oWzb8k16pWWfewlOwjlsX3vILJFXhm+U1bdEItdEn+q7GtBgpMpCe40/o8jfN/g
         jgQgSFwwpur4LcaxSnUvEirOX8hvzrSCQ8vEYo7eDWQ2RPSnpvb588TBJcDtRL981NAU
         oLU6WL84GZTdY6E8ZqlAR+XNeCJlDlMJW7dyMQW9vh3XFh6roNzaUAAHZmh3ZABZ7me1
         ucqxZkg6vh7Rl54SnajX3aP5YQGMZ/sVSTr9Jldgavq3/+3EF0EyHoBMtiK1+8KDJoYw
         Fh8VCpCnEpzDKxXuX8roIkN5lddTr528RjUycDJLLJ0AEHX/3GpSkZzV/9q4KVSTWA7C
         ETqQ==
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=xL8z9J/3+LN2qtPBRHUBTKylPHW3dT7jBqrWtEG6XNg=;
        b=KPPU3jlK6Nk2mhA6LjJJGh2H3auW6e92vnsEQh8RsI430mX1oa3F5YwsfGJC7gmImL
         w9NVhjKok0VAwkZaIxC4iBeWZT0lD0gavzcXG6n3uHLgY9liyOEXvgL6vF/n65EQtBQL
         K+gSZNfqPY6XUpbeKdkrcU4Qbt7NM/6oMzjpUcjm+0aH7iReqerX7K4YB3lP0fnIduyv
         acHSWvOB81xflyKvcKM0VRogiywjAkXmgnYZmjoYXpd5dOKesb/hpxv/kilEOdS7rKYE
         ZkZak7LVtfqr9TsUbo2I4bdZEnZvLeticeQaNg05jPYm7mL+MX5OjVVXX3+0XtqqZNzH
         AIBA==
X-Gm-Message-State: AG10YOQHQS7NPgjERli/5nCSWNZ+UX9idi2Ysjx9ohzrUEEAcNLHNcEV+7hw0rZn8J+KFQ==
X-Received: by 10.66.129.232 with SMTP id nz8mr47825502pab.102.1454995335343;
        Mon, 08 Feb 2016 21:22:15 -0800 (PST)
From: Bart Schaefer <schaefer@brasslantern.com>
Message-Id: <160208212222.ZM27970@torch.brasslantern.com>
Date: Mon, 8 Feb 2016 21:22:22 -0800
In-Reply-To: <20160209032308.GA20947@tarsus.local2>
Comments: In reply to Daniel Shahaf <d.s@daniel.shahaf.name>
        "Re: min() max() math functions (was: Re: Feature request (@M):# with context matches)" (Feb  9,  3:23am)
References: <CAKc7PVDCOPzbU25+vTAXMQjonS1sznDX_SBq4-8rUZPQewa5Tg@mail.gmail.com> 
	<CAKc7PVAe0N2bp2XS5U4mOKnTgxQRsj4UGy7NQpHput9VsbnAJw@mail.gmail.com> 
	<160130085456.ZM9730__49922.0612728552$1454172936$gmane$org@torch.brasslantern.com> 
	<20160207002212.GC24068@tarsus.local2> 
	<160206170040.ZM1927__13399.3204137825$1454806909$gmane$org@torch.brasslantern.com> 
	<20160209032308.GA20947@tarsus.local2>
X-Mailer: OpenZMail Classic (0.9.2 24April2005)
To: zsh-workers@zsh.org
Subject: Re: min() max() math functions (was: Re: Feature request (@M):# with context matches)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Seq: zsh-workers 37926

[>workers]

On Feb 9,  3:23am, Daniel Shahaf wrote:
}
} I said "built-in" but I meant in zsh/mathfunc, with all other math
} functions, for consistency.

I was talking about zsh/mathfunc, too.

} I suppose I could package them as an autoload.  Patch below. 

That's what I was going to suggest, even to the creation of Functions/Math/.

} How do I shield zmathfunc against callers that unsetopt functionargzero?

Sticky emulation would do it for you.  E.g.

    emulate zsh -c 'autoload -U zmathfunc'

Or examine $funcstack[1] instead of $0 (with localoptions noksharrays),
although that introduces a dependence on zsh/parameter.

} I guess I'll have to drop the the multifuncdef usage altogether?

See for example zmv, zcp, zln.

Although it seems an oversight that you can't combine -u and -M for the
functions command.

} +Autoloading tt(zmathfunc) defines the three mathematical functions

You do have to both autoload it and run it, like e.g. "colors".  Given
that, why not have zmathfunc perform "zmodload zsh/mathfunc" too?

} +++ b/Doc/Zsh/mod_mathfunc.yo
} +The functions tt(min), tt(max), and tt(sum) are defined not in this module
} +but in the tt(zmathfunc) autoloadable function

Ehh, I'm not sure it's the job of any module's doc to explain what it
does NOT define, much less to cross-reference zshcontrib.

