From 1233da3295e5a2fe67a61c240db7c8a363f6bd8e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 26 Aug 2023 01:01:23 -0700 Subject: awk: prn returns nil. * stdlib/awk.tl (awk-state prn): Return nil in the no-argument case instead of returning whatever put-string returns. * tests/015/awk-misc.tl: New file. * txr.1: Documented. --- stdlib/awk.tl | 3 ++- tests/015/awk-misc.tl | 10 ++++++++++ txr.1 | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/015/awk-misc.tl diff --git a/stdlib/awk.tl b/stdlib/awk.tl index e6ce26f9..197dbf38 100644 --- a/stdlib/awk.tl +++ b/stdlib/awk.tl @@ -188,7 +188,8 @@ (put-string `@(car a)`) (put-string (if (set next (cdr a)) self.ofs self.ors)))) (t (put-string self.rec) - (put-string self.ors)))) + (put-string self.ors) + nil))) (defmeth sys:awk-state ensure-stream (self kind path mode) (hash-update-1 self.streams diff --git a/tests/015/awk-misc.tl b/tests/015/awk-misc.tl new file mode 100644 index 00000000..af61857d --- /dev/null +++ b/tests/015/awk-misc.tl @@ -0,0 +1,10 @@ +(load "../common") + +(let ((*stdout* *stdnull*)) + (test + (build + (awk + (:inputs '("")) + (t (add (prn 1 2 3)) + (add (prn))))) + (nil nil))) diff --git a/txr.1 b/txr.1 index a89ef396..4ac510d9 100644 --- a/txr.1 +++ b/txr.1 @@ -70174,6 +70174,11 @@ Thus if the value is the output for that argument is an empty string, rather than the text .strn nil . +The +.code prn +function returns +.codn nil . + .coNP Macro @ next .synb .mets (next) -- cgit v1.2.3