summaryrefslogtreecommitdiffstats
path: root/tests/012/oop.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-09 19:08:02 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-09 19:08:02 -0700
commit2d173febd859a05708e14273397df61f75bea895 (patch)
tree966808b96729f9f367301f88256376b66d1738f6 /tests/012/oop.tl
parent0bb1f829c745d94386f17f37ed5568a20c7243e9 (diff)
downloadtxr-2d173febd859a05708e14273397df61f75bea895.tar.gz
txr-2d173febd859a05708e14273397df61f75bea895.tar.bz2
txr-2d173febd859a05708e14273397df61f75bea895.zip
Support curried args in method and meth.
* share/txr/stdlib/struct.tl (meth): Take trailing arguments and pass them down to method, which now accepts them. * struct.c (struct_init): Register method intrinsic to the function method_args instead of the method function. (method_args_fun): New static function. (method_args): New function. Behaves like method function if args is empty, otherwise creates a function by means of method_args_fun. * struct.h (method_args_fun): Declared. * tests/012/oop.tl: New test case. * tests/012/oop.expected: Updated. * txr.1: Documented new features in method and meth, revising the documentation in the process.
Diffstat (limited to 'tests/012/oop.tl')
-rw-r--r--tests/012/oop.tl10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/012/oop.tl b/tests/012/oop.tl
index 52fe30bb..34808af2 100644
--- a/tests/012/oop.tl
+++ b/tests/012/oop.tl
@@ -43,6 +43,16 @@
(mapcar (umeth print *stdout*) (list (new collie) (new dog)))
(put-line)
+(let* ((ssl (gun (make-string-output-stream)))
+ (s1 (pop ssl))
+ (s2 (pop ssl))
+ (s3 (pop ssl))
+ (d (new collie)))
+ [(meth d print s1)]
+ [(meth d print s2)]
+ [(meth d print s3)]
+ (tprint [mapcar get-string-from-stream (list s1 s2 s3)]))
+
(defstruct b nil
(:instance a 1)
(:instance b 2)