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/>
markb1 has joined #commonlisp
triffid has joined #commonlisp
troojg has joined #commonlisp
yitzi has quit [Remote host closed the connection]
random-nick has quit [Ping timeout: 260 seconds]
markb1 has quit [Read error: Connection reset by peer]
yitzi has joined #commonlisp
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 265 seconds]
markb1 has joined #commonlisp
meaty has joined #commonlisp
john is now known as synchromesh
josrr has quit [Remote host closed the connection]
spdegabrielle has quit [Quit: Connection closed for inactivity]
istewart has joined #commonlisp
Akbar-Birbal has joined #commonlisp
bigbookofbug has quit [Quit: leaving]
bigbookofbug has joined #commonlisp
lucasta has quit [Quit: Leaving]
X-Scale has joined #commonlisp
yitzi has quit [Remote host closed the connection]
char has joined #commonlisp
Demosthe1ex has quit [Ping timeout: 248 seconds]
Demosthenex has joined #commonlisp
synchromesh has quit [Read error: Connection reset by peer]
synchromesh has joined #commonlisp
char has quit [Ping timeout: 252 seconds]
pabs3 has joined #commonlisp
<beach> younder: The latest work has been done by scymtym, but it is not public yet.
Lord_of_Life has quit [Ping timeout: 265 seconds]
Lord_of_Life has joined #commonlisp
decweb has quit [Ping timeout: 276 seconds]
troojg has quit [Remote host closed the connection]
meaty has quit [Quit: touch grass]
istewart has quit [Quit: Konversation terminated!]
johnjaye has joined #commonlisp
JuanDaugherty has joined #commonlisp
istewart has joined #commonlisp
aeth_ has joined #commonlisp
aeth has quit [Quit: ...]
amb007 has joined #commonlisp
aeth has joined #commonlisp
X-Scale has quit [Quit: Client closed]
amb007 has quit [Ping timeout: 248 seconds]
chsasank9 has joined #commonlisp
aeth_ has quit [Quit: ...]
chsasank has quit [Ping timeout: 264 seconds]
chsasank9 is now known as chsasank
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Ping timeout: 252 seconds]
NotThatRPG has joined #commonlisp
meaty has joined #commonlisp
JuanDaugherty has quit [Quit: JuanDaugherty]
NotThatRPG has quit [Ping timeout: 260 seconds]
opinionplatform_ has joined #commonlisp
NotThatRPG has joined #commonlisp
istewart has quit [Quit: Konversation terminated!]
char has joined #commonlisp
char has quit [Remote host closed the connection]
NotThatRPG has quit [Ping timeout: 248 seconds]
cqst has quit [Quit: cqst]
cqst has joined #commonlisp
NotThatRPG has joined #commonlisp
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
NotThatRPG has quit [Ping timeout: 264 seconds]
Pixel_Outlaw has quit [Quit: Leaving]
NotThatRPG has joined #commonlisp
mgl__ has joined #commonlisp
NotThatRPG has quit [Ping timeout: 260 seconds]
NotThatRPG has joined #commonlisp
pkw has quit [Quit: leaving]
NotThatRPG has quit [Ping timeout: 265 seconds]
NotThatRPG has joined #commonlisp
beach` has joined #commonlisp
NotThatRPG has quit [Ping timeout: 260 seconds]
beach has quit [Ping timeout: 272 seconds]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Ping timeout: 252 seconds]
NotThatRPG has joined #commonlisp
wacki has joined #commonlisp
NotThatRPG has quit [Ping timeout: 260 seconds]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Ping timeout: 246 seconds]
NotThatRPG has joined #commonlisp
beach` is now known as beach
pve has joined #commonlisp
NotThatRPG has quit [Ping timeout: 260 seconds]
NotThatRPG has joined #commonlisp
BierLiebHaber_ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
BierLiebHaber has joined #commonlisp
NotThatRPG has quit [Ping timeout: 265 seconds]
NotThatRPG has joined #commonlisp
shka has joined #commonlisp
ingeniot has joined #commonlisp
benjaminl has quit [Read error: Connection reset by peer]
benjaminl has joined #commonlisp
oneeyedalien has joined #commonlisp
oneeyedalien has quit [Max SendQ exceeded]
oneeyedalien has joined #commonlisp
alcor has joined #commonlisp
NotThatRPG has quit [Ping timeout: 260 seconds]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Ping timeout: 276 seconds]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Ping timeout: 248 seconds]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Ping timeout: 252 seconds]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Ping timeout: 260 seconds]
NotThatRPG has joined #commonlisp
oneeyedalien has quit [Quit: Leaving]
jrx has joined #commonlisp
NotThatRPG has quit [Ping timeout: 246 seconds]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Ping timeout: 260 seconds]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Ping timeout: 244 seconds]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Ping timeout: 252 seconds]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Ping timeout: 260 seconds]
NotThatRPG has joined #commonlisp
cage has joined #commonlisp
cage has quit [Excess Flood]
cage has joined #commonlisp
jrx has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.4)]
flounders has joined #commonlisp
NotThatRPG has quit [Ping timeout: 265 seconds]
attila_lendvai has joined #commonlisp
mwnaylor has quit [Ping timeout: 260 seconds]
random-nick has joined #commonlisp
ingeniot has quit [Ping timeout: 256 seconds]
decweb has joined #commonlisp
alternateved has joined #commonlisp
shka has quit [Read error: Connection reset by peer]
synchromesh has quit [Read error: Connection reset by peer]
meaty has quit [Ping timeout: 260 seconds]
synchromesh has joined #commonlisp
shka has joined #commonlisp
edgar-rft_ has joined #commonlisp
johnjaye has quit [Ping timeout: 260 seconds]
edgar-rft has quit [Ping timeout: 246 seconds]
JuanDaugherty has joined #commonlisp
<alcor> Are funcallable instances not part of standard CL? They do not seem to exist in the CL package.
<alcor> Also, another question: What's the idiomatic way to construct a funcallable instance? I see (:metaclass funcallable-standard-class) being used in the clisp manual https://www.gnu.org/software/clisp/impnotes/mop-slot-access.html#mop-sa-funcallable but some people also seem to inherit from funcallable-standard-object in addition to that.
<ixelp> 29.10. Slot Access
johnjaye has joined #commonlisp
edgar-rft_ is now known as edgar-rft
<bike> alcor: they are in MOP, which is supported by pretty much all implementations. you can use the closer-mop package to paper over the small differences.
<bike> alcor: inheriting from funcallable-standard-object is implied if the direct superclasses list is empty and the metaclass is f-s-c. i.e. (defclass foo () ... (:metaclass funcallable-standard-class)) is fine.
<bike> to actually create an instance, use make-instance with your class, and then use set-funcallable-instance-function to install the function part.
<alcor> Thanks bike
AndreiDuma has joined #commonlisp
prokhor_ has joined #commonlisp
prokhor has quit [Ping timeout: 265 seconds]
pranav has quit [Remote host closed the connection]
McParen has joined #commonlisp
<decweb> Ooooh. TIL funcallable instances.
Demosthenex has quit [Ping timeout: 252 seconds]
cmack has quit [Ping timeout: 252 seconds]
Bubblegumdrop_ has joined #commonlisp
alternateved has quit [Ping timeout: 252 seconds]
Lord_of_Life has quit [Ping timeout: 252 seconds]
alternateved has joined #commonlisp
ello has quit [Ping timeout: 252 seconds]
Bubblegumdrop has quit [Ping timeout: 252 seconds]
cmack has joined #commonlisp
Lord_of_Life has joined #commonlisp
cqst has quit [Ping timeout: 252 seconds]
Demosthenex has joined #commonlisp
ello has joined #commonlisp
nani has quit [Ping timeout: 252 seconds]
pabs3 has quit [Ping timeout: 252 seconds]
nani has joined #commonlisp
<alcor> Is there an aref variant that returns NIL (or another, possible specifiable sentinel value) when the given array index is out of bounds?
<alcor> There is something weird about ,clhs aref – for some reason, it mentions nothing about error conditions, even obvious ones like out-of-bounds access.
<alcor> I thought of implementing such a function by handling the condition, but surprisingly the spec does not specify any specific condition to be signalled on OOB access :/
<pl> alcor: technically `cell-error` would be the right one
<pl> according to standard
<nil> alcor: It doesn't have to handle it so you can optimize to the fastest non-checking code. But most implementations do with default safety optimization.
pabs3 has joined #commonlisp
<alcor> pl: I just tried (handler-case (aref #(1 2) 10) (cell-error () nil)) on SBCL and it doesn't seem to work. Where does the standard mention it?
<Alfr> alcor, technically, it's UB. Because subscript says "valid array indices", then 1.4.4.3 applies (as it's not specified otherwise).
<nil> Thankfully one can write a safe-aref if you want which has the same semantics and insures the test either by optimize declarations or explict check.
<alcor> That is what I was trying to do actually, but I thought it was possible to write safe-aref the "lazy" way by leveraging condition handling.
<nil> But it's usually nicer to wave the the wand of declaim over the compiler to turn safety on or off.
<alcor> In the end, it does seem there is no alternative to bounds# checking :(
<_death> (if (array-in-bounds-p ...) (aref ...) nil)
<alcor> _death: Thanks, array-in-bounds-p is even better, cool.
<Alfr> alcor, you still might want a safe-aref ... it's easier to check that aref isn't used directly than to check that all uses of aref are properly preceded by an array-in-bounds.
<alcor> Alfr: Yes, exactly – but safe-aref can be trivially written in terms of `aref' and `array-in-bounds-p'.
<pl> alcor: it's underspecified area of the standard evidently - the text for cell-error does imply applicability, but cell-error-name does not cover arrays and aref isn't required to use it
pin56 has joined #commonlisp
<pin56> parenesys
shka has quit [Quit: Konversation terminated!]
shka has joined #commonlisp
josrr has joined #commonlisp
McParen has left #commonlisp [#commonlisp]
pin56 has quit [Ping timeout: 252 seconds]
pin56 has joined #commonlisp
AndreiDuma has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Hundo has joined #commonlisp
shawnw has quit [Ping timeout: 260 seconds]
pranav has joined #commonlisp
<beach> alcor: We address such undefined behavior in the WSCL project.
<alcor> WSCL?
<beach> Well Specified Common Lisp.
<beach> Let me find you the site...
<ixelp> GitHub - s-expressionists/wscl: Sources of the "Well Specified Common Lisp" specification which is based on the final dr [...]
<ixelp> wscl/wscl-issues/draft/aref-accessor-rank-error at main · s-expressionists/wscl · GitHub
rogersm has joined #commonlisp
<ixelp> wscl/wscl-issues/draft/aref-accessor-dimension-error at main · s-expressionists/wscl · GitHub
<beach> pin56: Are you new here? I don't recognize your nick.
Hundo has quit [Quit: Client closed]
<alcor> beach: Wow, thanks. The table below specifying each CL implementation's behavior is a big time saver!
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
<beach> Oh, yes, I can see that. Perhaps not all issues have that complete coverage.
tih has quit [Quit: WeeChat 4.0.2]
pin56 has quit [Remote host closed the connection]
pin56 has joined #commonlisp
pin56 has quit [Ping timeout: 248 seconds]
alternateved has quit [Remote host closed the connection]
rozenglass has quit [Ping timeout: 260 seconds]
rozenglass has joined #commonlisp
rozenglass has quit [Ping timeout: 260 seconds]
rozenglass has joined #commonlisp
<scymtym> yitzi was working on something that fills the current behavior part of issues automatically
<beach> Indeed.
<beach> It requires a particular syntax as I recall, but I can't remember the details now.
<beach> It wasn't very complicated.
spdegabrielle has joined #commonlisp
lucasta has joined #commonlisp
troojg has joined #commonlisp
shawnw has joined #commonlisp
traidare has joined #commonlisp
JuanDaugherty has quit [Quit: JuanDaugherty]
Algernon69 has joined #commonlisp
Algernon69 has quit [Client Quit]
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
troojg has quit [Ping timeout: 260 seconds]
Akbar-Birbal has left #commonlisp [#commonlisp]
<mrcom> Here's a puzzler--how can a macro discover the package it's being defined in?
<mrcom> The use-case is to determine if a passed-in symbol is in the same package.
<mrcom> (defmacro foo (x) (when (eq (symbol-package x) magic-foo-package-determiner) blah...)
<bike> you could store the read time package via #.*package*
<bike> i think it's probably not good to have a macro that works this way, though
<mrcom> Immediate use case is to pass X through, and declare it's type.
<mrcom> e.g., if x is "*standard-io*" then you can't do that--package locks.
<mrcom> s/standard-output/
<bike> you could just check if the package of the symbol passed in is locked
<mrcom> I could, but really don't want to reach out and change foreign packages that way. And thanks, "#.*package*" works. Now to decide if I actually want to to things this way...
<bike> who said anything about changing?
<bike> i just meant don't put in the declaration if the package is locked
<bike> another thing you could do is define your own variable and declare its type, depending on what this actually does
<bike> like (foo *standard-input*) expands into (let ((*internal* *standard-input*)) (declare (type whatever *internal*)) ...)
<mrcom> It's a with-xxx macro, the parameter is a symbol possibly used in the continuation body.
<mrcom> Thinking... why does locking a package preclude declaring symbol's type?
<mrcom> And it's declare, not declaim.
<mrcom> SBCL.
<mrcom> CCL doesn't care.
<mrcom> Oh, don't think CCL has locks.
<mrcom> ECL has locks and doesn't care.
<mrcom> I'll go ask on #sbcl.
k_hachig_ has joined #commonlisp
k_hachig_ is now known as k_hachig
<bike> sbcl has a bunch of stuff to let you mess with locked packages anyway
<bike> (declare (sb-ext:diable-package-locks ,x)) and you can go hog wild
jonatack has quit [Ping timeout: 248 seconds]
jonatack has joined #commonlisp
<mrcom> Yeah, but I want to be a tame hog, not a wild one.
<_death> you can check if it's a symbol from the CL package..
<mrcom> _death: That was the first option, but I got to wondering if it's bad for CL then is it bad for any external package? Hence q about checking for local package.
<mrcom> I could also check if the compiler already knows the symbol is bound to a stream, and skip the declare.
<_death> clhs 11.1.2.1.2
<_death> that's why it's bad for CL symbols.. other packages have no such privilege
yitzi has joined #commonlisp
<bike> if you're worried about this type declaration somehow being a problem, maybe don't have it at all?
brokkoli_origin has quit [Quit: (Leaving)]
cqst has joined #commonlisp
euandreh has joined #commonlisp
lucasta has quit [Remote host closed the connection]
<yitzi> mrcom: CCL doesn't have package locking. It has "freezing" of kernel functions. trivial-package-locks has some function to paper over the differences.
<yitzi> beach: The syntax is just a comment with an embedded => for functions that have return we want to test. Like this https://github.com/s-expressionists/wscl/compare/main...evaluator#diff-52888f23717aa1d8ee3fafcd08720f2c8a530310c56efe0d975aea205e31d231R38
<ixelp> Comparing main...evaluator · s-expressionists/wscl · GitHub
<yitzi> I haven't finished it yet. Distracted by other things.
rozenglass has quit [Ping timeout: 264 seconds]
brokkoli_origin has joined #commonlisp
rozenglass has joined #commonlisp
euandreh has quit [Quit: euandreh]
AndreiDuma has joined #commonlisp
<mrcom> Thanks _death, that section's helpful. Interestingly, 11.1.2.1.2.1 says it's OK to lexically bind & declare the binding type if it's _not_ a special or constant.
cage has quit [Quit: rcirc on GNU Emacs 29.4]
<bike> because a new lexical binding isn't going to affect or be affected by code elsewhere
<mrcom> bike: It's a cleanup of existing code. Knocking off "I don't know what this is" compile-time warnings. The macro's doing type checking.
<mrcom> A special rebinding... yeah. dynamic, so mess up anything your code calls.
<mrcom> Including implementation functions, which is what that's all about.
<mrcom> So I'm thinking the declaration isn't a bad idea in itself as long as it's a subtype of any existing type info, don't touch CL becuase of general "just don't mess with it, OK?". Don't declare on external packages just becuase and shouldn't need to anyway.
synchromesh has quit [Read error: Connection reset by peer]
synchromesh has joined #commonlisp
chsasank6 has joined #commonlisp
chsasank has quit [Ping timeout: 252 seconds]
chsasank6 is now known as chsasank
istewart has joined #commonlisp
AndreiDuma has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kevingal has joined #commonlisp
younder has quit [Remote host closed the connection]
pve has quit [Quit: leaving]
neuroevolutus has joined #commonlisp
rogersm has quit [Quit: Leaving...]
ingeniot has joined #commonlisp
amb007 has quit [Ping timeout: 276 seconds]
varjag has joined #commonlisp
alcor has quit [Ping timeout: 264 seconds]
younder has joined #commonlisp
yitzi has quit [Remote host closed the connection]
younder has quit [Remote host closed the connection]
AndreiDuma has joined #commonlisp
younder has joined #commonlisp
char has joined #commonlisp
JuanDaugherty has joined #commonlisp
mgl__ has quit [Ping timeout: 244 seconds]
ingeniot has quit [Ping timeout: 256 seconds]
AndreiDuma has quit [Read error: Connection reset by peer]
k_hachig has quit [Ping timeout: 276 seconds]
akoana has joined #commonlisp
mwnaylor has joined #commonlisp
Pixel_Outlaw has joined #commonlisp
attila_lendvai has quit [Ping timeout: 244 seconds]
shka has quit [Ping timeout: 252 seconds]
troojg has joined #commonlisp
char has quit [Ping timeout: 260 seconds]
neuroevolutus has quit [Ping timeout: 256 seconds]
wacki has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
neuroevolutus has joined #commonlisp
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 276 seconds]
traidare has quit [Ping timeout: 276 seconds]
robin has quit [Remote host closed the connection]
robin has joined #commonlisp
troojg has quit [Ping timeout: 248 seconds]
lucasta has joined #commonlisp
rozenglass has quit [Ping timeout: 264 seconds]
rozenglass has joined #commonlisp
<zyd> I often hear it stated that structs are faster than classes, but in what way are they faster?
johnjaye has quit [Ping timeout: 260 seconds]
varjag has quit [Ping timeout: 245 seconds]
johnjaye has joined #commonlisp
<bike> access to a structure is usually pretty direct: a memory read from a fixed offset into the structure. and, implementations are usually smart enough to keep slot values packed if you give them a type, and they'll preserve this information for optimizations
troojg has joined #commonlisp
<bike> current implementations don't optimize access into standard objects nearly as well, since it's a lot harder
reb has quit [Remote host closed the connection]
<younder> Seems to me that if you use a class the same way as you use a struct they should behave the same way. (defstruct rule pattern responses) -> (defclass rule ((pattern :initarg :pattern :accessor rule-pattern) (responses :initarg :responses :acessor rule-responses))) (defun make-rule (&key pattern reponses) (initialize-instance 'rule :pattern pattern :responses responses))
reb has joined #commonlisp
<younder> I mean the class version is way more verbose because all the functions are generated by default by the struct. But they achieve the same thing.
<bike> the devil is in the details. defstruct can define accessor functions that are just functions. defclass defines accessors that are generic functions, so there is a dispatching operation involved on every access
<bike> and classes can be redefined, unlike struct definitions, so there's some extra indirection to support that
<aeth> defstruct accessors are potentially inlineable and can preserve slot type information (which won't get redefined) for the implementation's type inference
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<aeth> so if you have an array that contains a certain numeric type as its :element-type and you stick it in a struct and you add e.g. :type (simple-array single-float (3)) then the implementation will know that an AREF on a call to that accessor function will return a single-float so the + function can be degenericized into the efficient floating point instruction
<aeth> for e.g. (+ (aref (foo-array your-struct) 2) 3f0)
neuroevolutus has quit [Ping timeout: 256 seconds]
<aeth> In theory you may be able to do something similar with defclass, but you're using a method (in my example, when accessing, your-struct must be your-struct or an error in isolation without needing any DECLAREs, etc.) and the class can be redefined so you're making things much harder.
<aeth> This has performance impacts on the arrays-of-numbers twice because it gets rid of the generic arithmetic and it gets rid of the bounds checks because both are in the array type, which can then be known to be the struct accessor's return type.
<aeth> Outside of arrays-of-numbers, I'm not sure there's that big of an impact.
bjorkintosh has joined #commonlisp
bjorkintosh has joined #commonlisp
bjorkintosh has quit [Changing host]
King_julian has joined #commonlisp
<zyd> actually really good to note, since my use case is exactly an array of floating point numbers
reb has quit [Remote host closed the connection]
reb has joined #commonlisp
char has joined #commonlisp
amb007 has quit [Ping timeout: 265 seconds]
mwnaylor has quit [Remote host closed the connection]
mwnaylor has joined #commonlisp
benjaminl has quit [Read error: Connection reset by peer]
benjaminl has joined #commonlisp
kevingal has quit [Ping timeout: 265 seconds]
JuanDaugherty has quit [Quit: JuanDaugherty]
spdegabrielle has quit [Quit: Connection closed for inactivity]
King_julian has quit [Ping timeout: 252 seconds]
rozenglass has quit [Quit: leaving]