Skip to content

Commit 76634c8

Browse files
committed
fix doc examples
1 parent 26fd815 commit 76634c8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/spread.nim

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ macro spread*(call: untyped, args: varargs[untyped]): untyped =
3232
assert arr == [1, 2, 3]
3333

3434
# table constructors:
35-
let tab = {:}.spread:
36-
"a" = 1 # constructors convert = in a statement to :
37-
_("b": 2, "c": 3) # all arguments of _ are spread directly
35+
when false: # (nim doc renders badly)
36+
let tab = {:}.spread:
37+
"a" = 1 # constructors convert = in a statement to :
38+
_("b": 2, "c": 3) # all arguments of _ are spread directly
3839

39-
assert tab == {"a": 1, "b": 2, "c": 3}
40+
assert tab == {"a": 1, "b": 2, "c": 3}
4041

4142
# object or tuple constructors need a single `_: _``:
4243
type Foo = object
@@ -75,6 +76,11 @@ macro spread*(call: untyped, args: varargs[untyped]): untyped =
7576
template `...`*(call: untyped, args: varargs[untyped]): untyped =
7677
## operator version of `spread`
7778
runnableExamples:
79+
proc foo(a, b, c: int) =
80+
echo "a: ", a
81+
echo "b: ", b
82+
echo "c: ", c
83+
7884
...foo:
7985
1
8086
c = 3

0 commit comments

Comments
 (0)