libera/#commonlisp - IRC Chatlog
Search
12:33:44
rotateq
I had a CLOS question in mind recently, but then I realized it was again easier than I thought. :) Just how to use FIND-METHOD correctly if a parameter in the lambda list is specialised with eql.
13:58:40
mfiano
I am working with a function that calls externals OS processes and returns a string as the result. This string consists of substrings delimited by tab characters and terminated by newline characters. What would be a decent way to produce a list of lists from this string, where each inner list represents the string cells of each column for a row, and the outer list contains these lists of rows?
14:04:59
mfiano
I never thought to use a csv parser, in part because I didn't know they supported other delimiters.
14:05:50
_death
this specimen seems like it's of a family of formats are usually known as tsv (tab-separated values), analogous to csv
14:07:23
mfiano
(The command I am calling has a switch that removes the first line of column names and transforms arbitrary numbers of whitespace to single tabs)
14:07:55
mfiano
It's meant for easier machine readability, though I do have the option of not using that switch if it makes it easier for Lisp
14:12:45
mfiano
I'm reviving a few thousand line shell script I wrote about 6 months ago, but it outgrew my least favorite host language and is very hard to maintain.
14:13:32
Guest74
there are some data table libraries out there, but afair they parse to their own format.
14:14:10
mfiano
My plan is to parse this data (and other output) into standard-objects, because it can benefit greatly be inheritance and generic dispatch.
14:15:39
mfiano
I'm using a nice wrapper over uiop:run-program that has nice conditions to handle in the event of a failure, instead of all the garbage-in/garbage-out bugs in my original shell script.
14:15:57
Guest74
after seeing what was inside of the csv libraries, I just basically use read-line and split-sequence.
14:21:48
Guest74
I can't remember the name of his library. I reading some other library that uses it, and can't remember that one either. I really hate this covid.
14:36:54
mfiano
Yeah I asked him about it. It also doesn't handle pipelining, which the current library I'm using does.
14:39:46
mfiano
Anyway, to answer my original question, I'm just using read-line and uiop:split-string
14:42:53
Nilby
sorry i know it doesn't help, but this is how i do it: (view-table (read-table (!! "program") :style +tsv+ :guess-types t))
15:09:12
Nilby
they are a massive tangled profusion of packges of bespoke and ramshackle nature, unfortunately entrenched in their own enclave