[Wrapl-discussion] How to invoke such method :"@"?
Brought to you by:
rajamukherji
|
From: Roman M. <rom...@gm...> - 2010-05-29 07:14:52
|
In the documentation there are descriptions for methods such as :"@". For
example, in Libraries:Agg:List there is
:"+"(a @ T, b @ T) : T
As I understand, it is possible to invoke this as
a:"+"(b);
and in its natural form:
a + b;
My question is how to propagate this rule to methods which description looks
like this:
:"@"(list @ T, _ = Std.String.T, sep @ Std.String.T) : Std.String.T
There is one character @ denotes an operator(method) and there are three
arguments. How to combine them in a call?
I want something similar to:
VAR text <- mylist@" "; Out:write(text);
I get:
Modname.wrapl(1): no method: @
Here is the code of what I want to accomplish:
MOD Bottles;
IMP IO.Terminal USE Out;
IMP Std.String;
IMP Std.List;
DEF ob <- "of beer", otw <- "on the wall";
VAR verse <- [], more <- "Take one down and pass it around", s <- "s", i;
EVERY i <- 9:to(0,-1) DO (
s <- ((2 > i) + 1)("s", "");
(i = 0) & (i <- "No more"; more <- "Go to the store and buy some more");
verse:put('. {i} bottle{s} {ob} {otw}.\n');
verse:put('\n{i} bottle{s} {ob} {otw}, {(i@String.T):lower} bottle{s}
{ob}.\n{more}');
);
-- EVERY Out:write(verse[2,0]:values); Out:write(verse[1]);
VAR Verse <- verse@" "; Out:write(Verse);
END Bottles.
And further question:
This command succeeds in Interactive Wraple:
--> ? mylist;
C:\Wrapl\lib\Agg\List.T
But the following does not:
--> Out:write(? mylist);
Unhandled message: no method: @
Why not and why @ again?
--
Roman
|