RosettaCodeData/Task/Singly-linked-list-Traversal/Limbo/singly-linked-list-traversal.limbo
2018-06-22 20:57:24 +00:00

20 lines
357 B
Text

implement Command;
include "sys.m";
sys: Sys;
include "draw.m";
include "sh.m";
init(nil: ref Draw->Context, nil: list of string)
{
sys = load Sys Sys->PATH;
l := list of {1, 2, 3, 4, 5};
# the unary 'tl' operator gets the tail of a list
for (; l != nil; l = tl l)
sys->print("%d\n", hd l);
# the unary 'hd' operator gets the head of a list
}