diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-03-28 07:34:01 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-03-28 07:34:01 -0700 |
commit | 051bf360110a5b9649fe9a2b5b35b2dcfed868d6 (patch) | |
tree | 52c45d2a3d6f45b96296481949a301b301952d3d | |
parent | fb10286e0a3d3da9599ae43b42db1d77d55ae46b (diff) | |
download | txr-051bf360110a5b9649fe9a2b5b35b2dcfed868d6.tar.gz txr-051bf360110a5b9649fe9a2b5b35b2dcfed868d6.tar.bz2 txr-051bf360110a5b9649fe9a2b5b35b2dcfed868d6.zip |
* eval.c (eval_init): register get-lines as having one optional
argument.
* lib.c (lazy_stream_cons): Default the argument to std_input.
* txr.1: Document that the stream is optional in get-lines.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | lib.c | 2 | ||||
-rw-r--r-- | txr.1 | 10 |
4 files changed, 20 insertions, 3 deletions
@@ -1,3 +1,12 @@ +2015-03-28 Kaz Kylheku <kaz@kylheku.com> + + * eval.c (eval_init): register get-lines as having one optional + argument. + + * lib.c (lazy_stream_cons): Default the argument to std_input. + + * txr.1: Document that the stream is optional in get-lines. + 2015-03-24 Kaz Kylheku <kaz@kylheku.com> * Makefile (enforce): Update error error message. @@ -4226,7 +4226,7 @@ void eval_init(void) reg_fun(intern(lit("break-str"), user_package), func_n2(break_str)); reg_fun(intern(lit("lazy-stream-cons"), user_package), func_n1(lazy_stream_cons)); - reg_fun(intern(lit("get-lines"), user_package), func_n1(lazy_stream_cons)); + reg_fun(intern(lit("get-lines"), user_package), func_n1o(lazy_stream_cons, 0)); reg_fun(intern(lit("lazy-str"), user_package), func_n3o(lazy_str, 1)); reg_fun(intern(lit("lazy-stringp"), user_package), func_n1(lazy_stringp)); reg_fun(intern(lit("lazy-str-force-upto"), user_package), func_n2(lazy_str_force_upto)); @@ -5171,6 +5171,8 @@ static val lazy_stream_func(val env, val lcons) val lazy_stream_cons(val stream) { + stream = default_arg(stream, std_input); + if (real_time_stream_p(stream)) { return make_lazy_cons(func_f1(stream, simple_lazy_stream_func)); } else { @@ -15034,14 +15034,20 @@ another lazy cons (as in the example under .coNP Functions @ lazy-stream-cons and @ get-lines .synb .mets (lazy-stream-cons << stream ) -.mets (get-lines << stream ) +.mets (get-lines <> [ stream ]) .syne .desc The .code lazy-stream-cons and .code get-lines -functions are synonyms. Thus, the following +functions are synonyms, except that the +.meta stream +argument is optional in +.code get-lines +and defaults to +.codn *stdin* . +Thus, the following description of .code lazy-stream-cons also applies to |