Yup, if you want them ordered. If not you could change the argument to collect.
You don't need the semicolon at the end, but it doesn't do anything if you
leave it in. The result is the same: `@[{"one": 1, "two": 2, "three": 3},
{"sun": 1, "mon": 2, "tue": 3, "wed": 4}]`
Ohh, now i got it my bad, so the code should be:
import tables, sugar, sequtils, strutils
let l = @[
{"one":1, "two":2, "three":3}.toOrderedTable,
collect(OrderedTable, (
for (i, j) in zip("sun mon tue wed".split(" "), (1..4).toSeq):
{i:j
`toTable` makes `Table`, but `newOrderedTable` makes `OrderedTableRef`.
Hello, so i was recently trying to use sugar's collect macro inside a sequence,
like this:
import tables, sugar, sequtils, strutils
let l = @[
{"one":1, "two":2, "three":3}.toTable,
collect(newOrderedTable, (
for (i, j) in zip("sun mon tue wed".spl