'Clojure result returned is always function rather then result
So I'm having trouble in that every time I evaluate a Clojure function, or type in in a REPL and call it, I'm not getting the result but something like #function[clojure.core/map/fn--5880].
What's causing this issue? I should be getting a result like a list here but I'm not. If I were to define everything in the REPL and run it, the result shows up just fine.
It mostly doesn't matter what I put in, Anything marginally advanced will cause this.
More specifics:
Upon request.
    (def filename "tester.csv")
    
    (defn parse
      "Convert a CSV into rows of columns"
      [string]
      (map #(clojure.string/split % #"\n")))
In REPL:
    (parse (slurp filename))
							
						Solution 1:[1]
In this specific case, you got function[clojure.core/map/fn--5880] and we can deduce from the name that this is a helper function defined in clojure.core/map. This is a transducer, which is returned when map is invoked only with one parameter. If you want a collection, give map a function and (at least) one collection.
Solution 2:[2]
What you want is:
(defn parse
  "Convert a CSV into rows of columns"
  [string]
  (clojure.string/split string #"\n"))
(parse (slurp "tester.csv"))
But csv you need to parse, because the delimiter can be part of the content of each cell (e.g. within quotation marks).
For that look at https://github.com/clojure/data.csv .
There in the Readme, you can see:
;; CLI/deps.edn dependency information:
;; so you add this into your `deps.edn`
org.clojure/data.csv {:mvn/version "1.0.1"}
;; Leiningen dependency information
;; and this you need into your project dependencies:
    [org.clojure/data.csv "1.0.1"]
;; Maven dependency information:
;; and this would be the maven dependency information,
;; if you would need it:
    <dependency>
      <groupId>org.clojure</groupId>
      <artifactId>data.csv</artifactId>
      <version>1.0.1</version>
    </dependency>
;; and this is how you use it:
(require '[clojure.data.csv :as csv]
         '[clojure.java.io :as io])
(with-open [reader (io/reader "in-file.csv")]
  (doall
    (csv/read-csv reader)))
(with-open [writer (io/writer "out-file.csv")]
  (csv/write-csv writer
                 [["abc" "def"]
                  ["ghi" "jkl"]]))
    					Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | erdos | 
| Solution 2 | Gwang-Jin Kim | 
