Fold to string

This commit is contained in:
Florian Schroedl
2022-06-10 13:57:21 +02:00
parent a8ed752d7f
commit b0b87869d9

View File

@@ -115,11 +115,11 @@ proc makeOrg*(x: string): OrgBuilderResult =
acc acc
proc foldOrg*(x: OrgBuilderResult): seq[string] = proc foldOrg*(x: OrgBuilderResult): string =
x x
.fold( .fold(
(err) => @["Error"], (err) => "Error",
(builder: OrgBuilder) => builder.tree.map((x: OrgBlock) => $x.headlineContent), (builder: OrgBuilder) => $builder.tree,
) )
# echo acc.unsafeGet().tree[^1] # echo acc.unsafeGet().tree[^1]
@@ -142,5 +142,5 @@ Some stuff inbetween
var acc = makeOrg(test1) var acc = makeOrg(test1)
echo acc .foldOrg() echo acc.foldOrg()
# echo acc.unsafeGet().tree[^1] # echo acc.unsafeGet().tree[^1]