lufia #5974(2008/03/06 17:14 GMT) [ Other ] Rating0/0=0.00
Limboでは、initの引数として文字列リストを得ます。 習慣的に、名前はargvまたはargs。 先頭がコマンド名、続いてa, b, c, d... リストは、hd(先頭の値を取得)、tl(先頭を除いたリストを取得)を使って操作します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
implement Argv; include "sys.m"; sys: Sys; include "draw.m"; Argv: module { init: fn(nil: ref Draw->Context, argv: list of string); }; init(nil: ref Draw->Context, argv: list of string) { sys = load Sys Sys->PATH; for(p := tl argv; p != nil; p = tl p) sys->print("%s\n", hd p); }
Rating0/0=0.00-0+
[ reply ]
lufia
#5974()
[
Other
]
Rating0/0=0.00
implement Argv; include "sys.m"; sys: Sys; include "draw.m"; Argv: module { init: fn(nil: ref Draw->Context, argv: list of string); }; init(nil: ref Draw->Context, argv: list of string) { sys = load Sys Sys->PATH; for(p := tl argv; p != nil; p = tl p) sys->print("%s\n", hd p); }Rating0/0=0.00-0+
[ reply ]