From 90a76320587e7a9e6a978809674451495a538fec Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 16 Apr 2021 18:03:45 +0000 Subject: [PATCH 3/5] docs: functions -M: Add a subheading and index entries. --- Doc/Zsh/builtins.yo | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 80a9e97db..264ee9484 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -893,6 +893,10 @@ without affecting the other. A typical idiom is that var(oldfn) is the name of a library shell function which is then redefined to call tt(newfn), thereby installing a modified version of the function. +em(The )tt(-M)em( and )tt(+M)em( flags) +cindex(defining mathematical functions) +cindex(functions, defining mathematical) + Use of the tt(-M) option may not be combined with any of the options handled by tt(typeset -f). @@ -929,6 +933,8 @@ Therefore, care must be taken not to use syntactical constructs that perform arithmetic evaluation after evaluating what is to be the result of the function. For example: +findex(zmath_cube) +findex(cube) example(# WRONG zmath_cube+LPAR()+RPAR() { (( $1 * $1 * $1 ))