File tree 2 files changed +13
-22
lines changed
2 files changed +13
-22
lines changed Original file line number Diff line number Diff line change @@ -1437,9 +1437,7 @@ proc defineModule*(moduleName: string) =
1437
1437
args = {
1438
1438
" number" : {Integer }
1439
1439
},
1440
- attrs = {
1441
- " discard" : ({Logical }," do not return anything" )
1442
- },
1440
+ attrs = NoAttrs ,
1443
1441
returns = {Any },
1444
1442
example = """
1445
1443
1 2 3
@@ -1448,30 +1446,23 @@ proc defineModule*(moduleName: string) =
1448
1446
1 2 3
1449
1447
b: unstack 2 ; b: [3 2]
1450
1448
..........
1449
+ ; You can also discard the values using `discard`
1451
1450
1 2 3
1452
- unstack. discard 1 ; popped 3 from the stack
1451
+ discard unstack 1 ; popped 3 from the stack
1453
1452
""" :
1454
1453
# =======================================================
1455
- if Stack [0 .. SP - 1 ].len < x.i: Error_StackUnderflow ()
1456
-
1457
- let doDiscard = (hadAttr (" discard" ))
1454
+ if Stack [0 .. SP - 1 ].len < x.i:
1455
+ Error_StackUnderflow ()
1458
1456
1459
1457
if x.i== 1 :
1460
- if doDiscard: discard stack.pop ()
1461
- else : discard
1458
+ discard
1462
1459
else :
1463
- if doDiscard:
1464
- var i = 0
1465
- while i< x.i:
1466
- discard stack.pop ()
1467
- i+= 1
1468
- else :
1469
- var res: ValueArray
1470
- var i = 0
1471
- while i< x.i:
1472
- res.add stack.pop ()
1473
- i+= 1
1474
- push (newBlock (res))
1460
+ var res: ValueArray
1461
+ var i = 0
1462
+ while i< x.i:
1463
+ res.add stack.pop ()
1464
+ i+= 1
1465
+ push (newBlock (res))
1475
1466
1476
1467
builtin " until" ,
1477
1468
alias = unaliased,
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ lookup: function [what :string :literal :regex :type][
176
176
]
177
177
178
178
PrintFList results "found"
179
- unstack. discard size stack
179
+ discard unstack size stack
180
180
]
181
181
182
182
Repl: #[autocomplete?: true, hints?: true, verbose?: true]
You can’t perform that action at this time.
0 commit comments