jackdaniel changed the topic of #commonlisp to: Common Lisp, the #1=(programmable . #1#) programming language | Wiki: <https://www.cliki.net> | IRC Logs: <https://irclog.tymoon.eu/libera/%23commonlisp> | Cookbook: <https://lispcookbook.github.io/cl-cookbook> | Pastebin: <https://plaster.tymoon.eu/>
rgherdt_ has quit [Remote host closed the connection]
morganw has quit [Remote host closed the connection]
tyson2 has quit [Remote host closed the connection]
tyson2 has joined #commonlisp
son0p has quit [Ping timeout: 255 seconds]
nij- has joined #commonlisp
pve has quit [Quit: leaving]
waleee has joined #commonlisp
perrierjouet has quit [Quit: WeeChat 3.7.1]
gateway2000 has joined #commonlisp
Odeqlmd has quit []
gateway2000 has quit [Quit: Leaving]
Lycurgus has joined #commonlisp
attila_lendvai has quit [Ping timeout: 246 seconds]
son0p has joined #commonlisp
Shareni has joined #commonlisp
masinter has joined #commonlisp
masinter has quit [Remote host closed the connection]
Lycurgus has quit [Quit: Exeunt: personae.ai-integration.biz]
Shareni has quit [Ping timeout: 252 seconds]
masinter has joined #commonlisp
coyotea has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
coyotea has quit [Ping timeout: 268 seconds]
azimut has quit [Ping timeout: 255 seconds]
azimut has joined #commonlisp
Bike has quit [Quit: sleep]
lispnik has joined #commonlisp
lispnik has quit [Client Quit]
lispnik has joined #commonlisp
lispnik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest28 has joined #commonlisp
Guest28 has quit [Quit: Client closed]
pranavats has left #commonlisp [Disconnected: Hibernating too long]
aartaka has joined #commonlisp
pranavats has joined #commonlisp
_paul0 has joined #commonlisp
paul0 has quit [Ping timeout: 265 seconds]
aartaka has quit [Ping timeout: 272 seconds]
aartaka has joined #commonlisp
aartaka has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
akonai has quit [Ping timeout: 252 seconds]
<beach> Oh, I almost forgot: Happy solstice everyone!
waleee has quit [Quit: WeeChat 3.7.1]
akonai has joined #commonlisp
sukaeto has quit [Ping timeout: 246 seconds]
<hayley> Fine, have your damn sun back.
igemnace has joined #commonlisp
waleee has joined #commonlisp
<beach> Thank you! :)
akonai has quit [Ping timeout: 246 seconds]
waleee has quit [Quit: WeeChat 3.7.1]
aartaka has quit [Ping timeout: 264 seconds]
aartaka has joined #commonlisp
gxt__ is now known as gxt
akonai has joined #commonlisp
aartaka has quit [Ping timeout: 260 seconds]
waleee has joined #commonlisp
aartaka has joined #commonlisp
thuna` has joined #commonlisp
akonai has quit [Ping timeout: 260 seconds]
sukaeto has joined #commonlisp
aartaka has quit [Ping timeout: 252 seconds]
aartaka has joined #commonlisp
frgo has quit [Ping timeout: 268 seconds]
shka has joined #commonlisp
rgherdt has joined #commonlisp
aartaka has quit [Ping timeout: 264 seconds]
aartaka has joined #commonlisp
akonai has joined #commonlisp
random-nick has joined #commonlisp
akonai has quit [Ping timeout: 260 seconds]
pve has joined #commonlisp
akonai has joined #commonlisp
_cymew_ has joined #commonlisp
azimut has quit [Quit: ZNC - https://znc.in]
akonai has quit [Ping timeout: 260 seconds]
azimut has joined #commonlisp
akonai has joined #commonlisp
aartaka has quit [Ping timeout: 246 seconds]
akonai has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
aartaka has quit [Ping timeout: 246 seconds]
akonai has joined #commonlisp
ttree has quit [Ping timeout: 246 seconds]
lagash has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
akonai has quit [Ping timeout: 260 seconds]
akonai has joined #commonlisp
akonai has quit [Ping timeout: 260 seconds]
puchacz has joined #commonlisp
akonai has joined #commonlisp
cage has joined #commonlisp
MajorBiscuit has joined #commonlisp
_cymew_ has quit [Ping timeout: 268 seconds]
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 272 seconds]
Lord_of_Life_ is now known as Lord_of_Life
sedzcat has joined #commonlisp
gateway2000 has joined #commonlisp
azimut has quit [Ping timeout: 255 seconds]
azimut has joined #commonlisp
gateway2000 has quit [Quit: Leaving]
gateway2000 has joined #commonlisp
Kingsy has quit [Ping timeout: 252 seconds]
aartaka has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
_cymew_ has joined #commonlisp
attila_lendvai has joined #commonlisp
jmdaemon has quit [Quit: ZNC 1.8.2 - https://znc.in]
seletz has quit [Ping timeout: 265 seconds]
seletz has joined #commonlisp
seletz has quit [Ping timeout: 272 seconds]
seletz has joined #commonlisp
son0p has quit [Ping timeout: 246 seconds]
sedzcat has quit [Ping timeout: 260 seconds]
sedzcat has joined #commonlisp
Devon has joined #commonlisp
ec has quit [Ping timeout: 255 seconds]
ec has joined #commonlisp
Devon has quit [Ping timeout: 264 seconds]
tyson2 has joined #commonlisp
Bike has joined #commonlisp
aartaka has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
jeosol has joined #commonlisp
Bike has quit [Quit: Client closed]
Bike has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
Bike has quit [Quit: leaving]
Bike has joined #commonlisp
cmack has joined #commonlisp
Odeqlmd has joined #commonlisp
attila_lendvai has quit [Ping timeout: 268 seconds]
frgo has joined #commonlisp
son0p has joined #commonlisp
les has quit [Ping timeout: 246 seconds]
aartaka has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
les has joined #commonlisp
tevo has quit [Read error: Connection reset by peer]
azimut has quit [Ping timeout: 255 seconds]
azimut_ has joined #commonlisp
attila_lendvai has joined #commonlisp
tevo has joined #commonlisp
pranavats has joined #commonlisp
seletz has quit [Ping timeout: 252 seconds]
cdegroot has quit [Read error: Connection reset by peer]
cdegroot has joined #commonlisp
aartaka has quit [Ping timeout: 268 seconds]
aartaka has joined #commonlisp
Nilby has quit [Ping timeout: 260 seconds]
Nilby has joined #commonlisp
nij- has left #commonlisp [Using Circe, the loveliest of all IRC clients]
seletz has joined #commonlisp
lagash_ has joined #commonlisp
seletz has quit [Ping timeout: 268 seconds]
<NotThatRPG> beach: Waiting to see if the Fenris Wolf ate the sun before celebrating...
attila_lendvai has quit [Ping timeout: 246 seconds]
<beach> Fair enough. Let's keep our fingers crossed.
<Reinhilde> hehe~
seletz has joined #commonlisp
Bike is now known as Bike
<_death> it wasn't the Fenris wolf though :).. it was another wolf, Skol.. and Managarm the moon
<_death> weird Simek interpretation though
azimut_ has quit [Ping timeout: 255 seconds]
waleee has quit [Ping timeout: 252 seconds]
ClickHacker has quit [Ping timeout: 264 seconds]
igemnace has quit [Remote host closed the connection]
* edgar-rft goes looking for his Gjallarhorrn
<_death> afaik Fenrir still struggles with Gleipnir ;) .. back to Lisp
<jackdaniel> NL - Nordic Lisp
MajorBiscuit has quit [Ping timeout: 246 seconds]
tyson2 has quit [Remote host closed the connection]
scymtym has joined #commonlisp
<NotThatRPG> @jackdaniel: Norwegian Death Lisp
aartaka has quit [Ping timeout: 246 seconds]
aartaka has joined #commonlisp
<Josh_2> Death metal band with a lisp
morganw has joined #commonlisp
MajorBiscuit has joined #commonlisp
chrcav has quit [Quit: leaving]
chrcav has joined #commonlisp
tyson2 has joined #commonlisp
jmdaemon has joined #commonlisp
ttree has joined #commonlisp
seletz has quit [Ping timeout: 272 seconds]
speskk has quit [Ping timeout: 248 seconds]
khrbt_ has joined #commonlisp
khrbt has quit [Ping timeout: 252 seconds]
peterhil_ has quit [Remote host closed the connection]
peterhil has joined #commonlisp
pdietz has joined #commonlisp
peterhil has quit [Read error: Connection reset by peer]
Cymew has joined #commonlisp
_cymew_ has quit [Ping timeout: 256 seconds]
seletz has joined #commonlisp
seletz has quit [Ping timeout: 260 seconds]
eron has joined #commonlisp
cosimone has joined #commonlisp
<Demosthenex> lordi?
<pjb> Lord I or l'ordinateur?
<Demosthenex> oh wait Lordi is from Finland, not norway
cosimone has quit [Remote host closed the connection]
cosimone has joined #commonlisp
sedzcat has quit [Ping timeout: 264 seconds]
sedzcat has joined #commonlisp
cosimone` has joined #commonlisp
cosimone has quit [Ping timeout: 272 seconds]
eron has quit [Quit: Client closed]
rgherdt has quit [Remote host closed the connection]
rgherdt has joined #commonlisp
varjag has joined #commonlisp
YaN3k has joined #commonlisp
<YaN3k> is there some value error that I can throw if the value of function argument is incorrect?
aartaka has quit [Ping timeout: 246 seconds]
aartaka has joined #commonlisp
peterhil has joined #commonlisp
<yitzi> YaN3k: Are you using check-type?
nij- has joined #commonlisp
<Josh_2> you can declare the type of arguments and if the safety settings are high enough you will get a type error. (defun test (a) (declare (type string a)) (print a)) -> (test 1) -> type error
cage has quit [Quit: rcirc on GNU Emacs 28.2]
nij- has left #commonlisp [Using Circe, the loveliest of all IRC clients]
Odeqlmd has quit [Remote host closed the connection]
<YaN3k> This seems interesting but what I'm looking for is to signal error if integer value is not in (0-255) range.
<YaN3k> is there some idiom to do this?
<_death> (check-type x (unsigned-byte 8))
<YaN3k> thanks!
seletz has joined #commonlisp
Noisytoot has quit [Ping timeout: 246 seconds]
seletz has quit [Ping timeout: 265 seconds]
<pjb> YaN3k: also, in general, (check-type x (integer 0 255))
<_death> I assumed you meant [0-255] ... otherwise it's (integer 1 254) or (and (unsigned-byte 8) (not (member 0 255))) or something
<pjb> Oops, yes, it was NOT.
<pjb> _death: but my point is that 10000000000000000 is an integer not in [0,255] range!
varjag has quit [Ping timeout: 268 seconds]
<pjb> and member is not a range, but a set.
<pjb> (typep 10000000000000000 '(and (unsigned-byte 8) (not (member 0 255)))) #| --> nil |#
<pjb> (typep 10000000000000000 '(and integer (not (integer 0 255)))) #| --> t |#
<_death> pjb: my remark was directed at YaN3k's
<pjb> I'm patching it.
<pjb> _death: but the error is to be signaled when it is not in the range [0, 255]. So checking for the type (integer 0 255) is correct.
puchacz has quit [Quit: Client closed]
<pjb> (mapcar (lambda (x) (typep x '(integer 0 255))) '(-1 0 1 2 254 255 256 10000)) #| --> (nil t t t t t nil nil) |#
<_death> yes, but YaN3k used (0-255) so may have meant (0, 255)
<pjb> YaN3k: you may signal type-error yourself. (unless (valid-value-p argument) (error 'type-error :datum argument :expected-type 'valid-value-type))
<pjb> YaN3k: you may define a condition class subclass of type-error, adding a format-control and format-arguments slots, (aka simple-type-error) if you want to add a specific error message.
<pjb> Oh, silly me, there's already a cl:simple-type-error
<pjb> (unless (valid-value-p argument) (error 'simple-type-error :datum argument :expected-type 'valid-value-type :format-control "Expects a valid value, not ~S" :format-arguments (list argument)))
<pjb> (let ((argument 400)) (error 'simple-type-error :datum argument :expected-type '(integer 0 255) :format-control "Expects an integer between 0 and 255, not ~S" :format-arguments (list argument))) #| ERROR: Expects an integer between 0 and 255, not 400 |#
<pjb> (error 'type-error :datum 400 :expected-type '(integer 0 255)) #| ERROR: The value 400 is not of the expected type (integer 0 255). |#
varjag has joined #commonlisp
<pjb> For example, I like to add the name of the function to the error message: (let ((argument 400)) (error 'simple-type-error :datum argument :expected-type '(integer 0 255) :format-control "Function ~S expects an integer between 0 and 255, not ~S" :format-arguments (list 'foo argument))) #| ERROR: Function foo expects an integer between 0 and 255, not 400 |# Using ~S and the symbol like this will print a qualified symbol when needed.
<_death> there's also assert..
Noisytoot has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
<pjb> indeed, and you can add a message to (let ((argument 4.2)) (check-type argument (integer 0 255) "an integer between 0 and 255 inclusive")) #| ERROR: value 4.2 is not an integer between 0 and 255 inclusive ((integer 0 255)). |#
<pjb> a string describing the expected type more precisely.
alejandrozf has quit [Ping timeout: 252 seconds]
<Josh_2> There is an advantage to using (declare (type ..)) over check-type
<Josh_2> You can maintain two builds, a development and a testing version, with different speed/safety settings
Cymew has quit [Ping timeout: 265 seconds]
<NotThatRPG> Also I often don't want a continuable error, which is what I get from check-type
<_death> why not?
<NotThatRPG> If I have a defgeneric with &allow-other-keys, shouldn't I be able to use &key and &allow-other-keys in method definitions?
<_death> it's a correctable error
<NotThatRPG> _death: Usually there's no way to fix the problem -- I have passed the wrong argument, and it's fatal
<_death> NotThatRPG: it gives you a restart to store a new value into the place, that satisfies the type
<_death> for your defgeneric question.. &allow-other-keys means you can pass any keys to the methods, so there's no need to specify that in defmethod
pdietz has quit [Quit: Client closed]
rgherdt_ has joined #commonlisp
rgherdt has quit [Read error: Connection reset by peer]
rgherdt__ has joined #commonlisp
rgherdt_ has quit [Read error: Connection reset by peer]
tyson2 has joined #commonlisp
rgherdt__ has quit [Ping timeout: 252 seconds]
pdietz has joined #commonlisp
ldb has joined #commonlisp
<NotThatRPG> I'm doing *something* wrong, but I'm not sure what: https://pastebin.com/1x7vxHGa
<ixelp> ;;; shouldn't this generic function lambda list(defgeneric find-which-plans - Pastebin.com
<_death> probably you want &key in your defgeneric (and don't need &allow-other-keys, but if you do, you should specify both)
<mfiano> Yes that
<ixelp> 28.1.6.4. Congruent Lambda-Lists for All Methods of a Generic Function
<ldb> > If any lambda-list mentions &rest or &key, each lambda-list must mention one or both of them.
rgherdt has joined #commonlisp
<ldb> The rule is stated so.
<NotThatRPG> So this: (domain problem which tasks top-tasks state &key) in defgeneric?
<_death> yes
<_death> unless you want every method to have to accept a :policy .. then you can add policy after the key
<_death> *the &key
<NotThatRPG> I did that but SBCL and Allegro still don't like the second lambda list.
<NotThatRPG> (with POLICY)
<_death> did what exactly?
sedzcat has quit [Quit: sedzcat]
<NotThatRPG> SBCL gives me method and generic function differ in whether they accept &REST or &KEY arguments.
<_death> (defgeneric foo (x &key)) (defmethod foo ((x integer) &key bar) (list x bar)) (foo 42 :bar 123)
<NotThatRPG> Hm. Wait, I think maybe it's OK....
tyson2 has quit [Remote host closed the connection]
<NotThatRPG> Odd. Allegro likes it, but SBCL still thinks it's wrong. Which makes me suspect I'm wrong, because SBCL is usually more stringent.
<_death> if you're doing everything in the same image with the same gf, make sure you fmakunbound first
<NotThatRPG> OMG, I think I see the problem.
<NotThatRPG> Yes, my bad. I needed to fix my defgeneric, but that broke *a different* defmethod form, and I was confused about which was broken. FACEPALM
tyson2 has joined #commonlisp
<ldb> ^that happend before right
jeosol has quit [Quit: Client closed]
semz has quit [Quit: ZNC 1.8.2+deb2build5 - https://znc.in]
semz has joined #commonlisp
aartaka has quit [Ping timeout: 264 seconds]
aartaka has joined #commonlisp
attila_lendvai has joined #commonlisp
<pjb> Josh_2: I see no advantage of using declare for the types. Only big pitfalls.
<pjb> Josh_2: Now, what you could do, is combine both: (defun foo (x) (check-type x the-type-x-must-have) (%foo x)) (defun %foo (x) (declare (type tye-type-x-must-have x)) …)
<pjb> Josh_2: here, foo will check the type at run-time, and offers you security, while %foo will assume the type of x, and be compiled the most efficient way possible (ie. without type checking).
<pjb> Josh_2: of course, you would never call %foo without having first checked the type of x.
<pjb> (defun bar () (let ((x (compute-some-x))) (check-type x the-type-x-must-have) (%foo x)))
<pjb> Josh_2: it's difficult to manage those two sets of functions, so in general, just write foo and use check-type; forget about declare.
<pjb> The only useful declare is declare special, when you want local dynamic variables.
aartaka has quit [Ping timeout: 264 seconds]
shka has quit [Ping timeout: 265 seconds]
<ldb> or if the compiler can unbox the data type, which sometimes can give huge performance gain
<ldb> if the type would be a pointer anyway, there is not much reason to declare it.
Posterdati has quit [Ping timeout: 272 seconds]
seletz has joined #commonlisp
jeosol has joined #commonlisp
cosimone` has quit [Remote host closed the connection]
seletz has quit [Ping timeout: 272 seconds]
Posterdati has joined #commonlisp
<jcowan> pjb: Declare special is the only *necessary* declare, in the sense that it changes semantics. It isn't the only useful one.
thuna` has quit [Remote host closed the connection]
azimut has joined #commonlisp
YaN3k` has joined #commonlisp
dra has joined #commonlisp
dra has quit [Changing host]
dra has joined #commonlisp
YaN3k has quit [Ping timeout: 268 seconds]
YaN3k` has quit [Ping timeout: 260 seconds]
<prxq> anyone using cl-json on latest sbcl? When I try to use 'with-decoder-simple-clos-semantics' I get "SB-MOP:CLASS-SLOTS called on #<FLUID-CLASS JSON:FLUID-OBJECT>, which is not yet finalized."
<prxq> btw what hapened to zach an xoph. No longer on IRC?
<phoe> prxq: does (sb-mop:finalize-inheritance (find-class 'json:fluid-object)) work around the issue?
<prxq> we shall see :-)
<prxq> yes!
<prxq> phoe: thx
varjag has quit [Ping timeout: 260 seconds]
<NotThatRPG> _death: ping?
ldb has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)]
tyson2 has quit [Ping timeout: 260 seconds]
peterhil has quit [Remote host closed the connection]
peterhil has joined #commonlisp
seletz has joined #commonlisp
seletz has quit [Ping timeout: 260 seconds]
<_death> sup
khrbt has joined #commonlisp
khrbt_ has quit [Ping timeout: 252 seconds]
MajorBiscuit has quit [Ping timeout: 260 seconds]
<NotThatRPG> _death: I recalled one of the reasons I don't like `check-type`
<phoe> what is it?
<NotThatRPG> It messes up SBCL's type-checking. SBCL doesn't recognize that after I (check-type foo bar) foo can be trusted to be of type bar.
<phoe> got an example? SBCL actually should be doing that
<NotThatRPG> type checking seems to do good reasoning over branches, but not over check-type.
<NotThatRPG> phoe: I think i could probably recover one -- I have a system where I shadowed CHECK-TYPE with my own definition that is not continuable for that reason.
tyson2 has joined #commonlisp
<phoe> NotThatRPG: https://plaster.tymoon.eu/view/3597#3597 like that or in some other way?
<phoe> what is your (sb-ext:describe-compiler-policy)?
<NotThatRPG> phoe: What I was seeing was SBCL saying it could not optimize something because of type uncertainty that I believed check-type could have resolved. And indeed, the type uncertainty went away with the shadowed check-type.
* NotThatRPG is having some trouble with his mechanical keyboard...
<NotThatRPG> phoe: It's getting late here and I have to go walk dogs, but I will try to find an MWE
<phoe> NotThatRPG: I'd like to see the code and warning in question; AFAIK it's possible that this type uncertainty thing disappeared because SBCL's ability to typecheck got *worse* rather than better because of your check-type modification, at least to the best of my understanding of SBCL
<phoe> sure, there's no rush; ping me when you find it
rgherdt has quit [Remote host closed the connection]
<phoe> it's almost 1 AM here anyway so
julio has joined #commonlisp
<_death> I guess the compiler could recognize that sometimes.. at least until there's some assignment later on.. but when I want to declare something to the compiler I don't really rely on check-type
julio is now known as ClickHacker
<NotThatRPG> _death: At least potentially it could cut down on the need for a lot of `locally` declarations. You check something's type and from then on the compiler should be able to trust its type and potentially optimize.
<NotThatRPG> Maybe my compiler policy is leaving the compiler being lazy
<_death> NotThatRPG: if it's a lexical variable, yeah.. unless there's some later assignment to it
<NotThatRPG> Right.
<phoe> yes, that's the idea in SBCL, as far as I know, and any deviations from this behavior might be bugs
<phoe> _death: I don't think that assigning to a variable is allowed to erase its type declaration
<_death> phoe: check-type is not a type declaration
<NotThatRPG> OK, I will go out now. If I don't report back tomorrow, it's because I froze to death!
NotThatRPG is now known as NotThatRPG_away
<phoe> _death: I see what you mean
<phoe> check-type works on a value, and reassigning the variable that value is bound to causes the value's typecheck to not be useful anymore