summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eval.c2
-rw-r--r--match.c4
-rw-r--r--txr.111
3 files changed, 11 insertions, 6 deletions
diff --git a/eval.c b/eval.c
index 40847c40..f5895520 100644
--- a/eval.c
+++ b/eval.c
@@ -6079,7 +6079,7 @@ void eval_init(void)
reg_fun(intern(lit("return*"), user_package), func_n2o(return_star, 1));
reg_fun(intern(lit("abscond*"), system_package), func_n2o(abscond_star, 1));
- reg_fun(intern(lit("match-fun"), user_package), func_n4(match_fun));
+ reg_fun(intern(lit("match-fun"), user_package), func_n4o(match_fun, 2));
reg_fun(intern(lit("time"), user_package), func_n0(time_sec));
reg_fun(intern(lit("time-usec"), user_package), func_n0(time_sec_usec));
diff --git a/match.c b/match.c
index 63cd572a..1283bd73 100644
--- a/match.c
+++ b/match.c
@@ -4557,10 +4557,12 @@ val match_filter(val name, val arg, val other_args)
}
}
-val match_fun(val name, val args, val input, val files)
+val match_fun(val name, val args, val input_in, val files_in)
{
val call = cons(name, args);
val spec = cons(cons(call, nil), nil);
+ val input = default_bool_arg(input_in);
+ val files = default_bool_arg(files_in);
val in_bindings = cdr(uw_get_match_context());
val data = if3(streamp(input),
lazy_stream_cons(input),
diff --git a/txr.1 b/txr.1
index e1894f19..d22c16ba 100644
--- a/txr.1
+++ b/txr.1
@@ -50264,7 +50264,7 @@ and
.coNP Function @ match-fun
.synb
-.mets (match-fun < name < args < input << files )
+.mets (match-fun < name < args >> [ input <> [ files ]])
.syne
.desc
The
@@ -50284,15 +50284,18 @@ pattern language, not \*(TL) and evaluated accordingly.
The
.meta input
argument is a list of strings, which may be lazy. It represents the
-lines of the text stream to be processed.
+lines of the text stream to be processed. If omitted, it defaults to
+.codn nil .
The
-.meta file
+.meta files
argument is a list of filename specifications, which follow
the same conventions as files given on the \*(TX command line. If the pattern
function uses the
.code @(next)
-directive, it can process these additional files.
+directive, it can process these additional files. If this argument is
+omitted, it defaults to
+.codn nil .
The
.code match-fun