libera/#commonlisp - IRC Chatlog
Search
5:24:22
semz
I don't understand this part of clhs 7.6.4: "The checking of the validity of keyword names is done in the generic function, not in each method. A method is invoked as if the keyword argument pair whose name is :allow-other-keys and whose value is true were supplied, though no such argument pair will be passed."
5:26:20
beach
It means that the method does not have to explicitly accept the keyword arguments that the generic function accepts because the verification is disabled.
5:27:45
semz
Oh, I see; I was unaware that :allow-other-keys had a special meaning for keyword functions.
6:14:55
doulos05
I've got a problem with a function that I want to assemble a string and then return it. https://pastebin.com/GAgdeDjH
6:19:27
doulos05
Both can hit. Eventually, there will be different forms of primary move and secondary move
6:20:02
doulos05
I wrapped those CONCATENATE calls in SETFs to mv-string to fix it, is that the best way?
6:20:29
White_Flame
there are many ways, and I don't think they're going to be that significantly different in syntactic size or performance
6:21:16
White_Flame
or have a single FORMAT string whose components render as "" if the conditional fails, etc
7:39:39
beach
doulos05: When you have an IF in a context where the value is not needed, and it has only a `then' branch, then it is preferable to us WHEN.
7:47:41
beach
Well, the COND only executes one clause. I think you said that both cases could be possible, and I assume that all those 15-20 cases could also be possible.
7:53:13
doulos05
Yeah, broadly speaking it would be the same COND replicated twice, so I'll eventually break that out into a separate function.
7:54:11
beach
But in the code you have, both IFs can be true. If you stick those cases in a COND, only one can be true.
7:55:20
beach
doulos05: Actually, you may want to join #clschool. This channel is not really meant for newbie questions, though they are tolerated to some extent.
7:59:48
beach
doulos05: So I think you have to make a decision. Either both cases (or all 15-20 cases) can be applicable, and then you can not use COND, or else only one case at a time can be applicable, in which case you should not have two consecutive IFs (or WHENs).
8:04:39
doulos05
Well, the choice is made by the game I'm porting from tabletop. Units have up to 2 movement options. The secondary movement options list is shorter than the primary movements option list, but there is considerable overlap.
8:05:46
doulos05
For now, I don't need the first WHEN because I've only implemented the two simplest movement options (one of which is always a secondary option). But eventually I'll need to handle both options.
8:08:55
Nilby
doubos05: i think effective use of format is a esoteric subject, but i'd be glad to explain weird format strings