diff --git a/docs/src/manpage.md b/docs/src/manpage.md index b73490f2d..8841f5938 100644 --- a/docs/src/manpage.md +++ b/docs/src/manpage.md @@ -2191,13 +2191,15 @@ FUNCTIONS FOR FILTER/PUT fmtifnum (class=conversion #args=2) Identical to fmtnum, except returns the first argument as-is if the output would be an error. - Example: - $* = fmtifnum($*, "%.6f") + Examples: + fmtifnum(3.4, "%.6f") gives 3.400000" + fmtifnum("abc", "%.6f") gives abc" + $* = fmtifnum($*, "%.6f") formats numeric fields in the current record, leaving non-numeric ones alone fmtnum (class=conversion #args=2) Convert int/float/bool to string using printf-style format string (https://pkg.go.dev/fmt), e.g. '$s = fmtnum($n, "%08d")' or '$t = fmtnum($n, "%.6e")'. This function recurses on array and map values. Example: - $x = fmtifnum($x, "%.6f") + $x = fmtnum($x, "%.6f") fold (class=higher-order-functions #args=3) Given a map or array as first argument and a function as second argument, accumulates entries into a final output -- for example, sum or product. For arrays, the function should take two arguments, for accumulated value and array element. For maps, it should take four arguments, for accumulated key and value, and map-element key and value; it should return the updated accumulator as a new key-value pair (i.e. a single-entry map). The start value for the accumulator is taken from the third argument. @@ -3181,5 +3183,5 @@ SEE ALSO - 2022-02-18 MILLER(1) + 2022-02-20 MILLER(1) diff --git a/docs/src/manpage.txt b/docs/src/manpage.txt index 2ad427d40..e296ccb45 100644 --- a/docs/src/manpage.txt +++ b/docs/src/manpage.txt @@ -2170,13 +2170,15 @@ FUNCTIONS FOR FILTER/PUT fmtifnum (class=conversion #args=2) Identical to fmtnum, except returns the first argument as-is if the output would be an error. - Example: - $* = fmtifnum($*, "%.6f") + Examples: + fmtifnum(3.4, "%.6f") gives 3.400000" + fmtifnum("abc", "%.6f") gives abc" + $* = fmtifnum($*, "%.6f") formats numeric fields in the current record, leaving non-numeric ones alone fmtnum (class=conversion #args=2) Convert int/float/bool to string using printf-style format string (https://pkg.go.dev/fmt), e.g. '$s = fmtnum($n, "%08d")' or '$t = fmtnum($n, "%.6e")'. This function recurses on array and map values. Example: - $x = fmtifnum($x, "%.6f") + $x = fmtnum($x, "%.6f") fold (class=higher-order-functions #args=3) Given a map or array as first argument and a function as second argument, accumulates entries into a final output -- for example, sum or product. For arrays, the function should take two arguments, for accumulated value and array element. For maps, it should take four arguments, for accumulated key and value, and map-element key and value; it should return the updated accumulator as a new key-value pair (i.e. a single-entry map). The start value for the accumulator is taken from the third argument. @@ -3160,4 +3162,4 @@ SEE ALSO - 2022-02-18 MILLER(1) + 2022-02-20 MILLER(1) diff --git a/docs/src/reference-dsl-builtin-functions.md b/docs/src/reference-dsl-builtin-functions.md index 07eb3badd..c1351de07 100644 --- a/docs/src/reference-dsl-builtin-functions.md +++ b/docs/src/reference-dsl-builtin-functions.md @@ -491,8 +491,10 @@ float (class=conversion #args=1) Convert int/float/bool/string to float. ### fmtifnum
 fmtifnum  (class=conversion #args=2) Identical to fmtnum, except returns the first argument as-is if the output would be an error.
-Example:
-$* = fmtifnum($*, "%.6f")
+Examples:
+fmtifnum(3.4, "%.6f") gives 3.400000"
+fmtifnum("abc", "%.6f") gives abc"
+$* = fmtifnum($*, "%.6f") formats numeric fields in the current record, leaving non-numeric ones alone
 
@@ -500,7 +502,7 @@ $* = fmtifnum($*, "%.6f")
 fmtnum  (class=conversion #args=2) Convert int/float/bool to string using printf-style format string (https://pkg.go.dev/fmt), e.g. '$s = fmtnum($n, "%08d")' or '$t = fmtnum($n, "%.6e")'. This function recurses on array and map values.
 Example:
-$x = fmtifnum($x, "%.6f")
+$x = fmtnum($x, "%.6f")
 
diff --git a/man/manpage.txt b/man/manpage.txt index 2ad427d40..e296ccb45 100644 --- a/man/manpage.txt +++ b/man/manpage.txt @@ -2170,13 +2170,15 @@ FUNCTIONS FOR FILTER/PUT fmtifnum (class=conversion #args=2) Identical to fmtnum, except returns the first argument as-is if the output would be an error. - Example: - $* = fmtifnum($*, "%.6f") + Examples: + fmtifnum(3.4, "%.6f") gives 3.400000" + fmtifnum("abc", "%.6f") gives abc" + $* = fmtifnum($*, "%.6f") formats numeric fields in the current record, leaving non-numeric ones alone fmtnum (class=conversion #args=2) Convert int/float/bool to string using printf-style format string (https://pkg.go.dev/fmt), e.g. '$s = fmtnum($n, "%08d")' or '$t = fmtnum($n, "%.6e")'. This function recurses on array and map values. Example: - $x = fmtifnum($x, "%.6f") + $x = fmtnum($x, "%.6f") fold (class=higher-order-functions #args=3) Given a map or array as first argument and a function as second argument, accumulates entries into a final output -- for example, sum or product. For arrays, the function should take two arguments, for accumulated value and array element. For maps, it should take four arguments, for accumulated key and value, and map-element key and value; it should return the updated accumulator as a new key-value pair (i.e. a single-entry map). The start value for the accumulator is taken from the third argument. @@ -3160,4 +3162,4 @@ SEE ALSO - 2022-02-18 MILLER(1) + 2022-02-20 MILLER(1) diff --git a/man/mlr.1 b/man/mlr.1 index 46c942397..8118f2ee6 100644 --- a/man/mlr.1 +++ b/man/mlr.1 @@ -2,12 +2,12 @@ .\" Title: mlr .\" Author: [see the "AUTHOR" section] .\" Generator: ./mkman.rb -.\" Date: 2022-02-18 +.\" Date: 2022-02-20 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "MILLER" "1" "2022-02-18" "\ \&" "\ \&" +.TH "MILLER" "1" "2022-02-20" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Portability definitions .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -3013,8 +3013,10 @@ flatten("", ".", {"a": { "b": 3 }}) is {"a.b" : 3}. .\} .nf (class=conversion #args=2) Identical to fmtnum, except returns the first argument as-is if the output would be an error. -Example: -$* = fmtifnum($*, "%.6f") +Examples: +fmtifnum(3.4, "%.6f") gives 3.400000" +fmtifnum("abc", "%.6f") gives abc" +$* = fmtifnum($*, "%.6f") formats numeric fields in the current record, leaving non-numeric ones alone .fi .if n \{\ .RE @@ -3025,7 +3027,7 @@ $* = fmtifnum($*, "%.6f") .nf (class=conversion #args=2) Convert int/float/bool to string using printf-style format string (https://pkg.go.dev/fmt), e.g. '$s = fmtnum($n, "%08d")' or '$t = fmtnum($n, "%.6e")'. This function recurses on array and map values. Example: -$x = fmtifnum($x, "%.6f") +$x = fmtnum($x, "%.6f") .fi .if n \{\ .RE