summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-09-12 05:44:32 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-09-12 05:44:32 -0700
commit46f53f9397c625a3e508c083416ce0c6d943a920 (patch)
tree12ddd2148093bc84f181e1519c8652fb295e27ac /txr.1
parent0528f634b395b5ee3bd78766e5530ba1a9321e1e (diff)
downloadtxr-46f53f9397c625a3e508c083416ce0c6d943a920.tar.gz
txr-46f53f9397c625a3e508c083416ce0c6d943a920.tar.bz2
txr-46f53f9397c625a3e508c083416ce0c6d943a920.zip
awk macro: new local macros ff and mf.
* share/txr/stdlib/awk.tl (sys:awk-let): New local macros. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.163
1 files changed, 63 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index e42696ee..04297f56 100644
--- a/txr.1
+++ b/txr.1
@@ -37865,6 +37865,69 @@ is evaluated. If it is true, then the range stays active for
the current record, but is deactivated when the processing of
the record completes.
+.coNP Macro @ ff
+.synb
+.mets (ff < opip-arg *)
+.syne
+.desc
+The awk macro
+.code ff
+(filter fields)
+provides a shorthand for filtering the field list
+.code f
+trough a pipeline of chained functions expressed using
+.code opip
+argument syntax.
+
+The following equivalence holds, except that
+.code f
+refers to the awk variable even if the
+.code mf
+invocation occurs in code which establishes
+a binding which shadows
+.codn f .
+
+.cblk
+ (ff a b c ...) <--> (set f [(opip a b c ...) f])
+.cble
+
+.TP* Example:
+.cblk
+ ;; convert all fields from string to floating-point
+ (ff (mapcar flo-str))
+.cble
+
+.coNP Macro @ mf
+.synb
+.mets (mf < opip-arg *)
+.syne
+.desc
+The awk macro
+.code mf
+(map fields)
+provides a shorthand for mapping each field
+individually trough a pipeline of chained functions expressed using
+.code opip
+argument syntax.
+
+The following equivalence holds, except that
+.code f
+refers to the awk variable even if the
+.code mf
+invocation occurs in code which establishes
+a binding which shadows
+.codn f .
+
+.cblk
+ (mf a b c ...) <--> (set f (mapcar (opip a b c ...) f))
+.cble
+
+.TP* Example:
+.cblk
+ ;; convert all fields from string to floating-point
+ (mf flo-str)
+.cble
+
.SS* Environment Variables and Command Line
Note that environment variable names, their values, and command line