diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-03-18 23:36:18 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-03-18 23:43:58 +0100 |
| commit | beca01c826ee51c9ee6d5eadd7e5ef10f7fb9f58 (patch) | |
| tree | e0ebb40b8775bba3b4be7bc47dceda3d349e2ac0 /tests/typ/code/for.typ | |
| parent | 77d153d315a2a5909840ebcd47491e4cef14428b (diff) | |
Methods
Diffstat (limited to 'tests/typ/code/for.typ')
| -rw-r--r-- | tests/typ/code/for.typ | 8 |
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) --- |
