diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | eval.c | 16 | ||||
-rw-r--r-- | txr.1 | 2 | ||||
-rw-r--r-- | txr.vim | 3 |
4 files changed, 28 insertions, 2 deletions
@@ -1,5 +1,14 @@ 2012-01-10 Kaz Kylheku <kaz@kylheku.com> + * eval.c (tostring, tostringp): New static functions. + (eval_init): New functions registered. + + * txr.1: Stub sections created. + + * txr.vim: Updated. + +2012-01-10 Kaz Kylheku <kaz@kylheku.com> + Spat of new features having to do with lazy processing. * eval.c (prog1_s, gen_s, generate_s, delay_s, promise_s): New symbol @@ -1247,6 +1247,20 @@ static val lazy_mappendv(val fun, val list_of_lists) return lazy_appendv(lazy_mapcarv(fun, list_of_lists)); } +static val tostring(val obj) +{ + val ss = make_string_output_stream(); + obj_print(obj, ss); + return get_string_from_stream(ss); +} + +static val tostringp(val obj) +{ + val ss = make_string_output_stream(); + obj_pprint(obj, ss); + return get_string_from_stream(ss); +} + static val symbol_function(val sym) { return lookup_fun(nil, sym); @@ -1547,6 +1561,8 @@ void eval_init(void) reg_fun(intern(lit("format"), user_package), func_n2v(formatv)); reg_fun(intern(lit("print"), user_package), func_n2(obj_print)); reg_fun(intern(lit("pprint"), user_package), func_n2(obj_pprint)); + reg_fun(intern(lit("tostring"), user_package), func_n1(tostring)); + reg_fun(intern(lit("tostringp"), user_package), func_n1(tostringp)); reg_fun(intern(lit("make-string-input-stream"), user_package), func_n1(make_string_input_stream)); reg_fun(intern(lit("make-string-byte-input-stream"), user_package), func_n1(make_string_byte_input_stream)); reg_fun(intern(lit("make-string-output-stream"), user_package), func_n0(make_string_output_stream)); @@ -5988,7 +5988,7 @@ Certain object types have a custom equal function. .SS Function format -.SS Functions print, pprint +.SS Functions print, pprint, tostring, tostringp .SS Function make-string-input-stream @@ -47,7 +47,8 @@ syn keyword txl_keyword contained < >= <= max min search-regex match-regex syn keyword txl_keyword contained make-hash gethash sethash pushhash remhash syn keyword txl_keyword contained hash-count get-hash-userdata set-hash-userdata hashp maphash syn keyword txl_keyword contained hash-eql hash-equal eval *stdout* *stdin* -syn keyword txl_keyword contained *stderr* format print pprint make-string-input-stream +syn keyword txl_keyword contained *stderr* format print pprint tostring tostringp +syn keyword txl_keyword contained make-string-input-stream syn keyword txl_keyword contained make-string-byte-input-stream make-string-output-stream syn keyword txl_keyword contained get-string-from-stream make-strlist-output-stream syn keyword txl_keyword contained get-list-from-stream close-stream |