I process all files in a directory, say:
(map file-handler files)
The only parameter to file-handler is naturally a file object. I want to know inside the file-handler the current "index" of the files sequence. The only solution I can see so far is to create a counter in the lexical closure, visible inside file-handler, and increment it there on each step. Perfectly feasible but not quite clojurelike. Is there a pure functional way to manage it?
fold
andreduce
– shmish111