Search
3:51:00
Lord_of_Life_
** NICK Lord_of_Life
6:17:26
beach
Good morning everyone!
10:20:43
tempate
Can I get tips to improve this piece of code? https://gist.github.com/Tempate/2a05c584e1b29c9c609c90856c566128
10:26:30
beach
tempate: Your indentation seems off.
10:27:21
beach
tempate: Your PROGN should be indented 2 spaces, but then, since LET has an implicit PROGN, you don't need it.
10:28:30
beach
You can use with-slots to avoid repeating (slot-value deck 'cards).
10:28:57
beach
But then I advise against using slot-value in favor of using a slot accessor.
10:30:35
tempate
What's wrong with slot-value?
10:31:32
beach
It is very low level. Usually, you design a data structure around classes and generic functions. That's known as a "protocol".
10:31:55
beach
A protocol is a generalization of an interface in other languages.
10:32:36
beach
Just as you don't want to access fields in a structure or class directly, you typically don't want to access Common Lisp slots directly.
10:32:53
beach
That's just basic software engineering.
10:33:02
beach
But for this small a problem, it won't matter.
10:33:18
beach
But you should definitely use WITH-SLOTS.
10:33:22
specbot
Couldn't find anything for with-slots..
10:33:24
specbot
http://www.lispworks.com/reference/HyperSpec/Body/m_w_slts.htm