Dear BaseX people,
I have a feature request:
a function which does the same as file:list, but returns the full paths. (In the explanation, I call it "file:list2")
Rationale:
(a) It is the full paths what we need in order to parse the files (doc(), json:doc(), csv:doc(), html:doc()).
(b) The combination of file listing and parsing in a single expression is of matchless elegance and expressivenessJust think about how we can extend this into a single list+parse+navigate+report expression, like:
file:list2($folder, true(), $fname) ! doc(.) ! //returnCode[. ne 0]/concat(base-uri(.), ': ', .)
(Wow! Is there any language or tool competing with this compactness and readability?)
Currently, if I don't overlook something, I have to do this: file:list($dir, false(), $fname) ! concat($dir, '/', .) ! doc(.) => count()
I emphasize the psychological aspect. Every time I have the pleasure to give a workshop about XQuery, I show off how elegant it is to parse a whole file system tree into a forest of nodes in a single expression. And I am always embarrassed about this clumsy fumbling montage of a path. It's as if Mozart had fallen asleep while writing his xquery sonata, knocked over the inkwell and now there is this splash smeared out on the score. You would be my heroes if you can spare us that.
Kind regards,Hans-Jürgen