[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]
A Macro for Steppers
- To: <eric@son-of-blob>
- Subject: A Macro for Steppers
- From: Eric Dean Tribble <xanadu!tribble>
- Date: Mon, 11 Dec 89 13:46:00 PST
- Cc: <xtech@son-of-blob>
- In-reply-to: <eric@son-of-blob'smessageofSun>,05 PST <8912110051.AA29427@xxxxxxxxxxxxxxxxxxxxxxx>
Last night I defined something similar in Smalltalk.
STPREXPR forEach: [:val {TYPE} | body]
translates to:
for (SPTR(Stepper) LoopStpr = STPREXPR;
LoopStpr ->hasValue();
LoopStpr ->step()) {
TYPE val = CAST(TYPE,LoopStpr->fetch());
body;
}
This can translate to the equivalent while loop. This covers most
uses. I can also have it translate to any macro you like. Note that
expression above creates the stepper in the STPREXPR.
dean