我对编程既新又老 - 主要是我在工作中编写了很多小的Perl脚本.当我想学习Lisp时,Clojure就出来了,所以我也在不知道Java的情况下学习Clojure.这很难,但到目前为止一直很有趣.
我已经看过几个类似问题的例子,但没有任何东西可以映射到我的问题空间.有没有规范的方法来提取Clojure中CSV文件的每一行的值列表?
这是一些实际工作的Perl代码; 包含非Perlers的评论:
# convert_survey_to_cartography.pl
open INFILE, "< coords.csv"; # Input format "Northing,Easting,Elevation,PointID"
open OUTFILE, "> coords.txt"; # Output format "PointID X Y Z".
while (<INFILE>) { # Read line by line; line bound to $_ as a string.
chomp $_; # Strips out each line's <CR><LF> chars.
@fields = split /,/, $_; # Extract the line's field values into a list.
$y = $fields[0]; # y = Northing
$x = $fields[1]; # x = Easting
$z …Run Code Online (Sandbox Code Playgroud)