0

I am trying to execute this piece of code:

(rest (file-seq (file (str "corpus/" "ham"))))

I want to get all files from "corpus/ham" directory, but I am getting this error: "error in process filter: stack overflow in regexp matcher".

Alan Thompson
  • 29,276
  • 6
  • 41
  • 48
nenad
  • 409
  • 3
  • 14
  • 1
    Seems okay (though `(file (str "corpus/" "ham"))` can be just `(file "corpus" "ham")`). How many files do you have in the corpus/ham directory? Do you get the same error no matter what directory you try? How about with an empty directory? – jas Dec 24 '18 at 16:58
  • In the corupus/ham directory I have 1400 files. – nenad Dec 24 '18 at 17:09
  • 1
    And if you try the same code on a directory with just a few files, does it work? – jas Dec 24 '18 at 17:13
  • Yes, I tried with only three files and it works. I got this: (#object[java.io.File 0x37a0dbc4 proba\ham] #object[java.io.File 0x4ca84c61 proba\ham\00001.1a31cc283af0060967a233d26548a6ce] #object[java.io.File 0x3c26d42f proba\ham\00002.5a587ae61666c5aa097c8e866aedcc59] #object[java.io.File 0x457eb5d4 proba\ham\00003.19be8acd739ad589cd00d8425bac7115]) – nenad Dec 24 '18 at 17:24
  • 5
    Searching for your error message reveals https://stackoverflow.com/q/31206568/625403, suggesting that this is an Emacs problem, not a Clojure problem. – amalloy Dec 24 '18 at 22:42
  • You need to provide additional details about *how* you are "trying to execute this piece of code" and who/where do you receive this error. – Stefan Dec 27 '18 at 16:23
  • I reinstalled Emacs and solved the problem. – nenad Dec 29 '18 at 00:03

2 Answers2

0

Works for me:

(ns tst.demo.core
  (:require [clojure.java.io :as io]))

with result:

-------------------------------------
   Clojure 1.8.0    Java 1.8.0_161
-------------------------------------

(rest (file-seq (io/file (str "test/" "clj")))) => 

  (#object[java.io.File 0x71c8e40e "test/clj/tst"]
   #object[java.io.File 0x65a44d8a "test/clj/tst/demo"]
   #object[java.io.File 0x7c3ccb39 "test/clj/tst/demo/core.clj"])

What is your environment? OS, clj & java version, etc? It also works on

Clojure 1.10.0    Java 11
Alan Thompson
  • 29,276
  • 6
  • 41
  • 48
0

I have tried the same on macOS, IntelijIdea community, Java 1.8 and Clojure 1.9

I see files present directory.

Narendra Pinnaka
  • 205
  • 1
  • 2
  • 11