<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."
<semz>
What is the point of the latter sentence?
<hayley>
:allow-other-keys won't appear in a &rest binding?
<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.
<beach>
So it is mostly restating what was said in the first sentence.
<semz>
Oh, I see; I was unaware that :allow-other-keys had a special meaning for keyword functions.
<beach>
:ALLOW-OTHER-KEYS T means that checking for invalid keywords is disabled.
Brucio-61 has quit [Ping timeout: 260 seconds]
masinter has quit [Ping timeout: 268 seconds]
masinter has joined #commonlisp
Brucio-61 has joined #commonlisp
<doulos05>
I've got a problem with a function that I want to assemble a string and then return it. https://pastebin.com/GAgdeDjH
<doulos05>
Currently, it is returning an empty string
<White_Flame>
concatenate doesn't mutate mv-string, it returns a new one
<doulos05>
Aha
<White_Flame>
COND would work well for this function
<White_Flame>
oh, unless both can hit and add 2 things to the string
<doulos05>
Both can hit. Eventually, there will be different forms of primary move and secondary move
<doulos05>
I wrapped those CONCATENATE calls in SETFs to mv-string to fix it, is that the best way?
<White_Flame>
there are many ways, and I don't think they're going to be that significantly different in syntactic size or performance
<White_Flame>
you could also use WITH-OUTPUT-TO-STRING and conditionally print to it
<White_Flame>
or have a single FORMAT string whose components render as "" if the conditional fails, etc
<White_Flame>
but yours is perfectly sensible
<doulos05>
Cool, then I'll probably leave it the way it is
<White_Flame>
hmm, FORMAT even has conditional fields with ~@[, no "" values required
azimut_ has quit [Ping timeout: 255 seconds]
Oladon has quit [Quit: Leaving.]
<Nilby>
"~:[~*~;~a~]~:[~;/~a~]"
<beach>
doulos05: Do you take unrelated remarks on your code?
frgo_ has joined #commonlisp
danieli9 has joined #commonlisp
remexre_ has joined #commonlisp
kabriel has joined #commonlisp
Noisytoot has quit [Killed (silver.libera.chat (Nickname regained by services))]
Noisytoot has joined #commonlisp
<White_Flame>
beach: yeah, s/IF/WHEN/ for one
leeb- has joined #commonlisp
micro_ has joined #commonlisp
prxq has joined #commonlisp
Patternm1ster has joined #commonlisp
marsia has joined #commonlisp
Bike_ has joined #commonlisp
pi1 has joined #commonlisp
famicom_guy_ has joined #commonlisp
Kingsy_ has joined #commonlisp
jfb4_ has joined #commonlisp
perrierjouet has quit [*.net *.split]
remexre has quit [*.net *.split]
marsia` has quit [*.net *.split]
prxq_ has quit [*.net *.split]
jfb4 has quit [*.net *.split]
micro has quit [*.net *.split]
johnjaye has quit [*.net *.split]
mathrick has quit [*.net *.split]
frgo has quit [*.net *.split]
steew has quit [*.net *.split]
Bike has quit [*.net *.split]
danieli has quit [*.net *.split]
famicom_guy has quit [*.net *.split]
Kingsy has quit [*.net *.split]
skempf has quit [*.net *.split]
empwilli has quit [*.net *.split]
Patternmaster has quit [*.net *.split]
leeb has quit [*.net *.split]
leeb- is now known as leeb
remexre_ is now known as remexre
danieli9 is now known as danieli
steew has joined #commonlisp
jfb4_ is now known as jfb4
<beach>
Right.
mathrick has joined #commonlisp
empwilli has joined #commonlisp
perrierjouet has joined #commonlisp
<doulos05>
Yeah, I'll take unrelated remarks
<doulos05>
Sorry, stepped away for a minute
<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.
epony has quit [Remote host closed the connection]
<doulos05>
Aha. Eventually, there will be a number of different move types
<doulos05>
Ultimately, I think there will be 15-20.
<beach>
Why is that important?
<doulos05>
Eventually, I'll replace it with a COND, right?
<doulos05>
At any rate, I replaced the IF with WHEN so I can get used to the preferred method
<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.
<beach>
But, yes, if only one case is possible, then COND is better than nested IFs.
<doulos05>
Yeah, broadly speaking it would be the same COND replicated twice, so I'll eventually break that out into a separate function.
<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.
<beach>
So it is not the same thing.
<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.
<doulos05>
aha, I didn't realize that. I'll jump into there
<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).
<Nilby>
or just use the lovely "~{~@[~a~]~^~:*~:[~;/~]~}"
* beach
has the impression that he is not explaining things very well.
<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.
<Nilby>
or actually "~{~@[~a~^/~]~^~}"
<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.
<doulos05>
Nilby: I snagged that second one to play with and see if I can make sense of it.
jeosol has quit [Quit: Ping timeout (120 seconds)]
<Nilby>
doubos05: i think effective use of format is a esoteric subject, but i'd be glad to explain weird format strings
azimut has joined #commonlisp
attila_lendvai has joined #commonlisp
Inline has joined #commonlisp
Patternm1ster has quit [Quit: leaving]
Patternmaster has joined #commonlisp
rgherdt has joined #commonlisp
shka has joined #commonlisp
azimut has quit [Ping timeout: 255 seconds]
pve has joined #commonlisp
Cymew has joined #commonlisp
Cymew has quit [Ping timeout: 248 seconds]
Gleefre has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
pranavats has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Grolter has joined #commonlisp
marsia has quit [Ping timeout: 268 seconds]
epony has joined #commonlisp
<seok->
I asked chatGPT what languages are suitable for metaprogramming,
<seok->
lisp came out on top
<beach>
Must be true then.
waleee has quit [Ping timeout: 252 seconds]
<Nilby>
nobody wants to write cdaadr etc explictly, but probably the humble posix shell is actually used more for metaprogramming
<beach>
But that was not the question. It maybe used more, but still less suitable.
mingus has joined #commonlisp
Guest25 has joined #commonlisp
Grolter has quit [Remote host closed the connection]
Guest25 has quit [Quit: Client closed]
karlosz has joined #commonlisp
pjb has joined #commonlisp
scymtym has joined #commonlisp
Grolter has joined #commonlisp
triffid has quit [Remote host closed the connection]
triffid has joined #commonlisp
genpaku has quit [Read error: Connection reset by peer]
genpaku has joined #commonlisp
triffid has quit [Ping timeout: 255 seconds]
random-nick has joined #commonlisp
triffid has joined #commonlisp
n0den1te has joined #commonlisp
<jackdaniel>
if anyone wants a mind-bending expierience I'm recommending implementing :arguments for define-method-combination - we expand body and arguments twice then - once for the method combination function and once for the effective method
<jackdaniel>
a perfect excercise for three comma programmers
karlosz has quit [Remote host closed the connection]
aartaka has joined #commonlisp
attila_lendvai has quit [Ping timeout: 260 seconds]
rgherdt_ has joined #commonlisp
rgherdt has quit [Ping timeout: 265 seconds]
<pjb>
3-, programmers, a different meaning here :-)
mingus has quit [Ping timeout: 252 seconds]
pranavats has left #commonlisp [Disconnected: Replaced by new connection]
pranavats has joined #commonlisp
VincentVega has joined #commonlisp
Fare has quit [Ping timeout: 260 seconds]
Inline has quit [Read error: Connection reset by peer]
<phoe>
contrapunctus: a meme used to describe your lisp proficiency
<phoe>
commas imply backquotes
<pjb>
contrapunctus: programmers able to write backquote forms 3 levels deep. `(… `(… `(… ,,,x …) …) …)
<contrapunctus>
oh o_O
<phoe>
if you can only grasp 0 backquotes you are not really a lisper
<phoe>
one backquote, you start understanding it
<jackdaniel>
contrapunctus: there is a trivia regarding a three star programmer (related to C - you dereference pointers to pointers to pointers)
<pjb>
code that generates code that generates code that generates code.
<contrapunctus>
eep
<jackdaniel>
and generally it means - a programmer who overcomplicates stuff
<phoe>
two backquotes, you're a lisp wizard capable of writing backquoted forms that generate backquote stuff
<jackdaniel>
it is adapted to common lisp. check out a phrase three star programmer in your search engine
<phoe>
three backquotes, you're beyond wizardry, and what pjb and jackdaniel said
<contrapunctus>
Right :)
<yitzi>
Four backquotes and you form a singularity and collapse into yourself.
<jackdaniel>
one more and the multiverse hs in danger
aartaka has quit [Ping timeout: 260 seconds]
<yitzi>
Nice! The escape route for an ever expanding universe...five lisp backquotes!
<scymtym>
i know this is not specified but what do people think (with-input-from-string (stream "hello" :start 2) (file-position stream)) should return? nil or 0 or 2 or something else?
<jackdaniel>
without much consideration 2 sounds like a sane value if you can afford it
<phoe>
if you are willing to put in the work to define and document the extension then 2 would be very nice to have, if not then NIL is a sane default
<scymtym>
i think 0 and 2 are both sane. i have a (weak) argument for preferring one over the other but i would like to hear other opinions first
<jackdaniel>
I read (wifs (stream string :start 2) ...) as a virtual version of (with-open-file (stream #<stringoid>) (setf (file-position stream 2)) ,@body)
<jackdaniel>
and not as (with-open-file (stream (subseq string 2)) ,@body)
<phoe>
0 feels wrong because (... "hello" :start 2) is a different thing than (... "llo") even if they seem to produce equivalent results in the body
<phoe>
yes, what jackdaniel said
<phoe>
if you open a file containing "hello" and then set the file position to 2 then the file position is going to be 2
<phoe>
which is a different thing than opening a file containing "llo"
<phoe>
scymtym: do you plan on supporting the two-arg FILE-POSITION for string input streams?
<phoe>
because this is where it might be of particular importance
<phoe>
if :START is set to 0, then should the two-arg FILE-POSITION be able to rewind beyond that and access earlier characters?
<phoe>
or is :START and :END supposed to work like in SUBSEQ and effectively pass only a slice of the string into the stream
<phoe>
that's already an API design question and I'm not good with these
<scymtym>
phoe: setting the file position is a consideration, yes. i'm thinking about the user's perspective. in particular what WSCL could say in this regard
<phoe>
;; hayley: completely unrelated but I just realized that WSCL and SWCL are anagrams
<scymtym>
yeah, :END is an issue since that must behave in the SUBSEQ sense, i think
<phoe>
scymtym: I think WSCL would ask what implementations already do
<phoe>
and then act based on that
karlosz has joined #commonlisp
<beach>
minion: What does SWCL stand for?
<minion>
Stellerine Wokas Common Lisp
<scymtym>
what they do is disagree :)
<phoe>
:D
<phoe>
what kind of disagreement do they already do
<scymtym>
0 vs. 2
<scymtym>
the ones i checked
<jackdaniel>
beach: steel wool common lisp (ask hayley, I don't remember details)
<scymtym>
phoe: sure, you can work around the issue but it seems like an unnecessary point of divergence
<phoe>
it's a point of divergence that will be hard to otherwise converge though
<phoe>
this sounds like a very good WSCL issue with very poor chances of resolving if in favor of one common definition of "what does a file position mean when applied to a string"