I am writing a piece of code to be read in a text data file. The text file is in the format:
name 1 4 name 2 4 5 name 3 1 9
I am trying to create a map vector in the form [:name Sarah :weight 1 cost :4]
.
When I try to read a file using the -qq line reader, it reads each line as an element, so the section is incorrect. See below:
(let [file-text (line-seq (reader "C://Drugs/myproject/src/myproject/data.txt")) new-test-items (vec (map
Then I tried to just take 1 section, but still the structure is wrong.
=> (let [file-text (line-seq (reader "C://Drugs/myproject/src/myproject/data.txt")) new-test-items (vec (map
Then I tried to rip out the file, but this is worse:
=> (let [slurp-input (slurp "C://Drugs/myproject/src/myproject/data.txt") part-items (partition 3 slurp-input) mapping (vec (map
Please, help! It seems like such an easy thing in Java, but it kills me in Clojure.
source share