Hey, so I'm working on the game set-cubed in Scheme (for those who know the game). Currently, i have a csv file of all the possible dice with dice faces. I'm trying to read this into scheme, and managed to do that with a csvreadermaker. Currently, i can get it into a vector, but i want to pull out individual items in this vector to compare. Preferably, i want something that I can use that acts similarly to a 2 dimensional array. Here's what I have:

(require (planet neil/csv:1:6/csv))

(define set-cubed-csv-reader ;#####Creating our reader for the CSV file#####
   '((separator-chars #\,)
     (strip-leading-whitespace? . #t)
     (srtip-trailing-whitespace? . #t))))

 (define next-row
    (set-cubed-csv-reader (open-input-file "setcubed.csv"))) ;####We just defined (next-row) to give us the next row in each line of setcubed.csv

This is some output:
> (define v (next-row))
> v
("dienum" "face1" "face2" "face3" "face4" "face5" "face6")

I want to be able to pull each element out of the vector, but also easily be able to get more vectors for the next line down in the csv file.
How do I go about doing this?

7 Years
Discussion Span
Last Post by rotflcopter

:P Ha ha, having a similar problem?
I actually managed to get it to work! Turns out that when I did that (above), i get a list instead. It's weird,going back and forth between lists and vectors.


I'm actually trying to figure out how to read the csv in haha I was using an example in the powerpoint but that wasn't working very well for me so I was looking for a better way to read it...


Thanks! yeah it's just under slides in the t drive but apparently they're just slowing me down! haha I hope I dont't have to stay up all night...


you mean pop it into a vector? I managed to put it inside a vector of a vector, and then went through and grabbed a "dice" and then a "face". My problem now is doing proper equality checks with strings




I don't understand this!! I can't index the vector. it's just stored as one big vector and when I call the 0th index it gives me the exact same vector, I can't access parts of it

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.