Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: min() max() math functions (was: Re: Feature request (@M):# with context matches)


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.

Messages sorted by: Reverse Date, Date, Thread, Author