libera/#commonlisp - IRC Chatlog
Search
13:56:03
mfiano
jackdaniel: Thanks for the suggestion, but I think I'll stick with bsd cron as it hooks into the mail and logging system automatically.
15:50:17
trev
would someone mind explaining how this works in plain english? https://github.com/google/lisp-koans/blob/master/koans-solved/mapcar-and-reduce.lisp#L58
15:54:46
Josh_2
(apply #'mapcar #'list '((a b c) (d e f))) -> (mapcar (lambda (x y) (list x y)) '(a b c) (d e f)). Something like that
15:57:07
Josh_2
(apply #'mapcar #'list '((a b c) (d e f)(g h i))) -> (mapcar (lambda (x y z) (list z y z)) '(a b c) '(d e f) '(g h i))
16:00:11
easye`
<https://github.com/armedbear/abcl/pull/490/files#diff-ccaa655ebf1432951ff70b34dcd6e82428cba2c5035e8077c7b183a6551bba3dR98>
16:14:40
Bike
trev: say you have lists = ((1 2) (3 4)). then (apply #'mapcar #'list lists) = (mapcar #'list '(1 2) '(3 4))
16:24:56
mfiano
trev: It does a matrix transposition. It converts rows to columns and columns to rows.
16:28:09
mfiano
Yes, now try playing with it using lists of different lengths and see if you can understand what is happening.
16:29:19
trev
i ended up reading the docs after asking (wrong of me) and that also helped me create a mental image of how the iteration goes
17:16:31
bollu
Hmm, How do I use cl-csv to write a `struct` ? `cl-csv:write-csv-value` seems to have coerced the entire struct into a string, which was not what I expected
17:20:11
Bike
if you have your own format in mind, looks like you might need to specialize write-csv-value
17:20:46
Bike
given that structs are readable, i guess you can just provide a :formatter that uses cl:write? and then figure out how to read it back
17:22:41
bollu
Bike Hmm, if I have a `struct`, is there some easy way to convert it to a list of its slot values?
17:32:29
White_Flame
bollu: in my experience, stuff like that involves generating your defstruct and support functions like that together
17:33:00
White_Flame
eg, you have your list of slots that you want, and codegen the actual defstruct call and the defuns for all the per-slot handling routines
17:34:12
bollu
I now wonder if given a reference to a function, if I can find the name of the defun that defined it?
17:34:26
bollu
[I understand that this is a tall ask, since a function reference could have come from a closure or some such]
17:35:06
White_Flame
if you just print the function object, your implementation might display it for you
17:35:21
Bike
mfiano: among other things, i don't think it is possible with decode-object working like it does. if you have two objects that contain each other, there is no way to decode one without already having the other
17:35:23
mfiano
Bike: They hang out in our lisp dev team's channel #bufferswap if you want to ask anything.
17:35:48
White_Flame
SBCL is fairly good at having named/printed representation for defuns, passed-around LABELS functions, anonymous closures, etc
17:36:56
bollu
I wonder if it's possible to somehow, given a common lisp object, find the classes the object implements
17:37:22
Bike
mfiano: thank you, but i think i'm doing ok right now. i still haven't had to alter the wire format at all, so i think it's going fine
17:38:19
White_Flame
yeah, you need to have a list of fields somewhere; generate your defstruct from it, and use the list to print your csv title line and other iterators
17:38:25
mfiano
Bike: I think it's fairly well-designed from my memory of the code. My only complaint, is a complaint with all of his projects: WITH-SLOTS being used everywhere.
17:38:39
bollu
White_Flame I think if you see the gist, you will find the list of slots as csv-fields-to-write
17:39:00
bollu
Oh, wait, are you suggesting I store the *label* of the slot and use the CLOS generic slot accessor functions?
17:39:17
Bike
mfiano: yeah, it's pretty good. i haven't e.g. had to touch the encoder at all. it just seems like circular references are a little underexercised
17:39:41
Bike
another thing i found was that conses (rather than lists) don't support circularity at all
17:39:49
White_Flame
you currently have two separate usages of per-slot named things, which will get out of sync if you change teh struct
17:40:00
White_Flame
if it's all driven from one slot specification list, then evertyhing will stay aligned
17:40:03
mfiano
Bike: Great. I'm sure he will accept a PR when you're done. He is just hesitant of added complexity.
17:40:19
Bike
having implemented compile-file before, i already know all kinds of weird trickery that comes up with circular lisp bullshit