A strange behavior in seq

2024-04-12 Thread Araq
Use `os.walkDir` and an idea like: import std / [os, sets, sequtils] proc fileExt(dir: string; res: var Hashset[string]) = for k, f in walkDir(dir): if k == pcFile: res.incl splitFile(f).ext elif k == pcDir: fileExt(f, res) proc fileExt(dir: str

A strange behavior in seq

2024-04-12 Thread Tina
I created a mini-program to retrieve file extensions within the current directory. However, when I intended to chain-call the apply function in a sequence, I discovered that constructing a var T from a given T was not possible. Consequently, I wrote a conversion function, as shown below: