diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-10-09 10:46:03 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-10-09 10:46:03 -0700 |
commit | 0bb1f829c745d94386f17f37ed5568a20c7243e9 (patch) | |
tree | 6ddb384c58ecc190677e1e28098c22b5aa89ba21 /tests | |
parent | 4ad96a94657fe688da3f89102c5cc0decd268037 (diff) | |
download | txr-0bb1f829c745d94386f17f37ed5568a20c7243e9.tar.gz txr-0bb1f829c745d94386f17f37ed5568a20c7243e9.tar.bz2 txr-0bb1f829c745d94386f17f37ed5568a20c7243e9.zip |
Support curried arguments in umethod and umeth.
* share/txr/stdlib/struct.tl (umeth): accept variadic
arguments. Evaluate them using the dwim brackets
and pass to umethod. The (fun umethod) trick is
used to refer to the umethod in the function namespace
even if it is shadowed by a variable.
* struct.c (struct_init): Update registration of umethod to
reflect its new variadic argument signature.
(umethod_args_fun): New static function.
(umethod): Return a function based on umethod_fun,
as before, if there are no variadic args. Otherwise,
use umethod_args_fun which deals with them.
* struct.h (umethod): Declaration updated.
* tests/012/oop.tl: Modest testcase for umeth
with curried argument.
* tests/012/oop.expected: Updated.
* txr.1: Updated documentation of umeth and umethod.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/012/oop.expected | 1 | ||||
-rw-r--r-- | tests/012/oop.tl | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/tests/012/oop.expected b/tests/012/oop.expected index f0bb554f..433a51d2 100644 --- a/tests/012/oop.expected +++ b/tests/012/oop.expected @@ -11,6 +11,7 @@ animal canine collie poodle +colliecanine #S(b a 1 b 2 c 3) #S(d a nil b -2 c 3) (10 20 300 42 42) diff --git a/tests/012/oop.tl b/tests/012/oop.tl index 24cf2726..52fe30bb 100644 --- a/tests/012/oop.tl +++ b/tests/012/oop.tl @@ -40,6 +40,9 @@ (pprinl (new poodle)) +(mapcar (umeth print *stdout*) (list (new collie) (new dog))) +(put-line) + (defstruct b nil (:instance a 1) (:instance b 2) |