Skip to content

Commit

Permalink
实现一个有趣的东西
Browse files Browse the repository at this point in the history
  • Loading branch information
A4-Tacks committed Oct 27, 2024
1 parent f33caa4 commit 24d095c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions examples/for_each.mdtlbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#**
* 整活性质的利用现有工具制作一个看起来很舒适的简单功能for循环
* 关于尝试将bang伪装的很先进
*#
const For = (const match @ {
*I [in] _ *Stop F {
setres For[I in 0 .. Stop .. 1 F];
}
*I [in] *Start _ *Stop F {
setres For[I in Start .. Stop .. 1 F];
}
*I [in] *Start _ *Stop _ *Step F {
I = Start; while I < Stop {
setres F[I];
I += Step;
}
}
*I [of] @ F {
inline@ Arg {{
take Builtin.Const[I `Arg`];
take F[];
}}
}
});

For! i in 1..@links (
print i;
);
print "---";
For! `I` of @copper @lead (
print I;
);

#* >>>
set i 1
jump 5 greaterThanEq i @links
print i
op add i i 1
jump 2 lessThan i @links
print "---"
print @copper
print @lead
*#

0 comments on commit 24d095c

Please sign in to comment.