-
Notifications
You must be signed in to change notification settings - Fork 0
@dolist
@dolist
command: @dolist[/] [] =
is a list of strings, which can be object numbers, attributes, or arbitrary words. is a command to perform once for each item in , replacing the special symbol ## with the corresponding item from , and the symbol #@ with the position in the list, starting with one. by default, @dolist considers each item in to be separated with spaces. if you specify the /delimit switch, then each item is considered to be separated by . must be a single character.
if present, can be any of: /space - (default) list elements are separated by spaces. /delimit - list elements are separated by . /notify - queues a '@notify' after all commands in the list.
this command is particularly handy with lcon() and lexits(). a few examples:
@dolist [lcon(here)] = "name(##) @dolist [lcon(here)] = @switch [get(##/last)]=1990,"[name(##)] @va me = va vb vc @dolist [get(me/va)] = @emit [get(me/##)] @dolist frodo bilbo gandalf = page ## = help!!!! i've fallen into a pit. @dolist/delimit , {frodo, bilbo baggins, gandalf} = page ## = help!!!! @wait me="this is a semaphore. @dolist/notify lnum(3)=say ##
you say, "0" you say, "1" you say, "2" you say, "this is a semaphore."
related topics: iter(), @notify, semaphores.