summaryrefslogtreecommitdiff
path: root/tests/typ/code/for.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-03-18 23:36:18 +0100
committerLaurenz <laurmaedje@gmail.com>2022-03-18 23:43:58 +0100
commitbeca01c826ee51c9ee6d5eadd7e5ef10f7fb9f58 (patch)
treee0ebb40b8775bba3b4be7bc47dceda3d349e2ac0 /tests/typ/code/for.typ
parent77d153d315a2a5909840ebcd47491e4cef14428b (diff)
Methods
Diffstat (limited to 'tests/typ/code/for.typ')
-rw-r--r--tests/typ/code/for.typ8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/typ/code/for.typ b/tests/typ/code/for.typ
index e161ba84..822f7423 100644
--- a/tests/typ/code/for.typ
+++ b/tests/typ/code/for.typ
@@ -32,10 +32,10 @@
// Should output `2345`.
#for v in (1, 2, 3, 4, 5, 6, 7) [#if v >= 2 and v <= 5 { repr(v) }]
-// Loop over captured arguments.
-#let f1(..args) = for v in args { (repr(v),) }
-#let f2(..args) = for k, v in args { (repr(k) + ": " + repr(v),) }
-#let f(..args) = join(sep: ", ", ..f1(..args), ..f2(..args))
+// Map captured arguments.
+#let f1(..args) = args.positional().map(repr)
+#let f2(..args) = args.named().pairs((k, v) => repr(k) + ": " + repr(v))
+#let f(..args) = (f1(..args) + f2(..args)).join(", ")
#f(1, a: 2)
---