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/>
Oladon has quit [Quit: Leaving.]
son0p has joined #commonlisp
morganw has quit [Remote host closed the connection]
masinter has joined #commonlisp
pawa2 has quit [Ping timeout: 255 seconds]
eddof13 has joined #commonlisp
eddof13 has quit [Client Quit]
dtman34 has quit [Ping timeout: 252 seconds]
dtman34 has joined #commonlisp
pmwals09 has joined #commonlisp
waleee has quit [Ping timeout: 252 seconds]
robin_ is now known as robin
waleee has joined #commonlisp
pmwals09 has quit [Remote host closed the connection]
jonatack1 has joined #commonlisp
jon_atack has quit [Read error: Connection reset by peer]
pmwals09 has joined #commonlisp
pmwals09 has quit [Remote host closed the connection]
pmwals09 has joined #commonlisp
Krystof has quit [Ping timeout: 255 seconds]
pmwals09 has quit [Remote host closed the connection]
pmwals09 has joined #commonlisp
theesm has quit [Ping timeout: 255 seconds]
random-nick has quit [Ping timeout: 268 seconds]
theesm has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 268 seconds]
Lord_of_Life has joined #commonlisp
pmwals09 has quit [Remote host closed the connection]
waleee has quit [Ping timeout: 246 seconds]
knusbaum has quit [Quit: ZNC 1.8.2 - https://znc.in]
knusbaum has joined #commonlisp
jonatack1 has quit [Ping timeout: 246 seconds]
<kevingal> What's the standard way to make an extensible array with push and pop operations? I currently have (make-array 3 :adjustable t :fill-pointer 0), and I can extend it using (vector-push-extend arr), but it seems very verbose.
<kevingal> I figured that out based on the cookbook, just wondering if there's a better way.
bitmapper has joined #commonlisp
mingus has joined #commonlisp
<Bike> i mean, that's it. if you don't like the function names you could define some trivial wrappers.
<Bike> (declaim (inline make-ext-array)) (defun make-ext-array (len) (make-array len :adjustable t :fill-pointer 0)) kind of thing.
<pjb> kevingal: you can avoid the adjustable and extend if you know an upper bound of the size, and you allocate it at the beginning.
<pjb> (let ((v (make-array 3000 :fill-pointer 0))) (loop for i below 10 do (vector-push i v)) v) #| --> #(0 1 2 3 4 5 6 7 8 9) |#
<pjb> kevingal: and when you use vector-push-extend, you want to pass an extension that is proportional to (length v) to obtain asymptotically O(1) operation, so it's even more verbose: (vector-push-extend new-elem v (length v))
<pjb> Of course, you can wrap that in a (collect new-element v) abstraction.
<kevingal> Thanks, good to know!
azimut has quit [Ping timeout: 255 seconds]
aartaka has joined #commonlisp
aartaka has quit [Ping timeout: 246 seconds]
aartaka has joined #commonlisp
aartaka has quit [Ping timeout: 246 seconds]
aartaka has joined #commonlisp
bilegeek_ has quit [Quit: Leaving]
bitmapper has quit [Quit: Connection closed for inactivity]
kevingal has quit [Ping timeout: 248 seconds]
pve has joined #commonlisp
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
semarie has quit [Remote host closed the connection]
semarie has joined #commonlisp
kenran has joined #commonlisp
occ has quit [Ping timeout: 252 seconds]
<pve> Good morning! If have a macro that expands into another defmacro, like so:
<pve> then could someone explain why the ",'" part shows up in the macroexpansion?
masinter has quit [Ping timeout: 246 seconds]
<pve> I mean I'm wondering why it's ','*FOO* instead of just '*FOO*
occ has joined #commonlisp
<pve> Initially, I would have liked to just have ',,variable in the defmacro, but the macroexpansion doesn't look right then.
aartaka has quit [Ping timeout: 246 seconds]
aartaka has joined #commonlisp
<jackdaniel> ,',x expands to a symbol behind x
<jackdaniel> consider ,,x -> ,symbol -> symbol is unbound error
<jackdaniel> ,',x -> ,'symbol -> symbol
<jackdaniel> well, not necessarily a symbol but you have a gist of it
kenran has quit [Remote host closed the connection]
<pve> sure, I get it, I was just a bit confused about the ,' since macroexpand-1 already put in the symbol *FOO*, so it seems unnecessary
shka has joined #commonlisp
<pve> actually I'm not sure I totally get it
<pve> specifically, I can see that the two commas in ',',variable are "used" to resolve the symbol *FOO*
<pve> but why does one comma remain in the macroexpansion?
aartaka has quit [Ping timeout: 255 seconds]
aartaka has joined #commonlisp
<pve> Oh, could it be SBCL-specific behaviour? CCL returns a macroexpansion that looks like something I expected.
<beach> The comma is just a product of how the pretty printer displays the macro form that the reader generates.
<beach> There is no actual comma in the expression.
aartaka has quit [Ping timeout: 260 seconds]
<pve> hmm, ok.. does that mean `(...) generates something other than a list in sbcl?
_cymew_ has joined #commonlisp
<beach> It generates a macro call. And SBCL uses some trick for comma, like a struct or something, so that the pretty printer can print a comma.
qhong has quit [Remote host closed the connection]
<beach> You might want to try to print the result without the pretty printer.
<beach> Like (let ((*print-pretty* nil)) (print '`(a b ,c d)))
qhong has joined #commonlisp
<pve> beach: yeah, it does show a different output
<pve> my example macro includes a #S(SB-IMPL::COMMA ..) struct
<pve> ok, well that's good enough for me, thanks!
qhong has quit [Quit: ZNC 1.8.2 - https://znc.in]
qhong has joined #commonlisp
qhong has quit [Remote host closed the connection]
qhong has joined #commonlisp
<beach> Sure.
Guest51 has joined #commonlisp
Guest51 has quit [Client Quit]
glaucon has joined #commonlisp
X-Scale has joined #commonlisp
aartaka has joined #commonlisp
aartaka has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
shka has quit [Quit: Konversation terminated!]
Krystof has joined #commonlisp
shka has joined #commonlisp
bjorkintosh has quit [Ping timeout: 252 seconds]
aartaka has quit [Ping timeout: 255 seconds]
X-Scale has quit [Quit: Client closed]
aartaka has joined #commonlisp
triffid has quit [Remote host closed the connection]
triffid has joined #commonlisp
Lycurgus has joined #commonlisp
X-Scale has joined #commonlisp
akoana has joined #commonlisp
aartaka has quit [Ping timeout: 255 seconds]
aartaka has joined #commonlisp
rogersm has quit [Quit: Leaving...]
Brucio-61 has quit [Ping timeout: 260 seconds]
random-nick has joined #commonlisp
quoosp has joined #commonlisp
aartaka has quit [Ping timeout: 248 seconds]
aartaka has joined #commonlisp
azimut has joined #commonlisp
pranavats has left #commonlisp [Disconnected: Hibernating too long]
akoana has quit [Quit: leaving]
karlosz has joined #commonlisp
pranavats has joined #commonlisp
cage has joined #commonlisp
* jcowan claims the title of "chief advisee on keyword arguments"
jmdaemon has quit [Ping timeout: 248 seconds]
<jackdaniel> did you mean perchance 'keyword parameters'? :) arguments are things you pass to the functions, parameters are the things in the lambda list
Brucio-61 has joined #commonlisp
prokhor__ has joined #commonlisp
prokhor has quit [Ping timeout: 252 seconds]
aartaka has quit [Ping timeout: 268 seconds]
aartaka has joined #commonlisp
aartaka has quit [Ping timeout: 255 seconds]
aartaka has joined #commonlisp
<jcowan> Well, the two go together: if you declare keyword parameters, you expect to be called with keyword arguments (which are, technically, two consecutive arguments)
karlosz has quit [Quit: karlosz]
<jcowan> Conceptually, if I write (foo 1 2 :x 3 :y 4), I am calling foo with four arguments, not six.
<jackdaniel> you got it backwards, there are four parameters, yet the number of arguments is six
karlosz has joined #commonlisp
<jackdaniel> assuming that the lambda list is (a b &key x y)
<jackdaniel> let's make it sommelier then!
karlosz has quit [Client Quit]
aartaka has quit [Ping timeout: 248 seconds]
jonatack has joined #commonlisp
aartaka has joined #commonlisp
<pjb> jcowan: note that you can write: (let ((a 1) (b 2) (c :x) (d 3) (e :y) (f 4)) (foo a b c d e f)) ; six arguments, definitely.
masinter has joined #commonlisp
<jackdaniel> it goes like this: [arguments] ----pixie dust----> [parameters], that's why lambda lists with keyword parameters have a peformance penalty (perhaps call-site optimization can fix that, not sure)
<jackdaniel> but that's a negligible-except-for-a-tight-loop penalty so usually there is no need to bother with that
<pjb> also, note that ((lambda (&key (a nil ap)) (list a ap))) 0 arguments, 2 parameters!
<jackdaniel> banzai
<beach> jackdaniel: Call-site optimization can fix that problem in cases where the call site has keywords as opposed to other forms that evaluate to keywords.
<jackdaniel> I see, that's what I thought. Thanks.
<Bike> in basic cases you can even do it with a relatively simple compiler macro
tyson2 has joined #commonlisp
<jcowan> pjb: True, but not the typical case at all.
<jackdaniel> beach: but that requires the implementation to allow multiple entry points, am I right?
<jackdaniel> (multiple entry points to a function that is)
<beach> Yes, there would be an entry point that does argument parsing and another that considers argument parsing done.
<beach> The latter one would have indications about where it wants arguments to be stored, like in a register or in a particular slot in the stack frame.
<jackdaniel> I suppose that could be implemented as two functions if the target does not support multiple entry points (with the parser trampolining to the real function)
<beach> It could be done that way, yes. But then there would still be overhead by the requirement that the trampoline call must obey the general function-call protocol.
<beach> But, yes, it would fix the keyword-argument parsing overhead.
<jackdaniel> I'm just wondering how that would fit if the target is a C language (which does not support multiple entry points)
<jackdaniel> that's why I've asked
<beach> Yes, then your idea seems reasonable.
X-Scale has quit [Quit: Client closed]
aartaka has quit [Ping timeout: 252 seconds]
X-Scale has joined #commonlisp
bjorkintosh has joined #commonlisp
bjorkintosh has joined #commonlisp
bjorkintosh has quit [Changing host]
attila_lendvai has joined #commonlisp
chipxxx has joined #commonlisp
chipxxx has quit [Remote host closed the connection]
chipxxx has joined #commonlisp
kevingal has joined #commonlisp
Guest63 has joined #commonlisp
karlosz has joined #commonlisp
glaucon has quit [Quit: Leaving.]
luis9 has joined #commonlisp
glaucon has joined #commonlisp
chip_x has joined #commonlisp
quoosp has quit [Ping timeout: 255 seconds]
karlosz has quit [Quit: karlosz]
chipxxx has quit [Ping timeout: 246 seconds]
<buffet> hey, i have some set of pieces in a chess game, and i want to associate those with their positions. in C i would use an enum and an array, using the enum value as an index. what would be the best way to achieve something like that in common-lisp?
<buffet> right now i use symbols and some symbol to index function, but i'm not a big fan of that
<beach> Do you mean you would use an enum for the pieces?
aartaka has joined #commonlisp
<beach> You can use an array in Common Lisp too.
<buffet> beach: i would, yeah
<beach> Keyword symbols are often used in Common Lisp where enums are used in C.
<buffet> the issue with the array approach is that i have `(cond piece (:black-queen 4) [...] (t (error)))` somewhere, which i'm not to fond off
<beach> But for a chess game, I can very well see a piece being an instance of a standard class, so that you can have generic functions for things like allowed moves.
<beach> I don't understand, why is there an error in Common Lisp but not in C?
<buffet> mostly because `positions[piece]` leaves less room for it
<beach> But you would do (positions piece) instead if you use instances of standard classes.
<buffet> mhm, i hadn't thought about using classes
rgherdt has joined #commonlisp
<beach> Probably because that option is not available to you in C.
aartaka has quit [Ping timeout: 252 seconds]
<buffet> most definitely
<buffet> thanks!
<beach> Sure.
<saturn2> if you really want a C enum you could do something like (defmacro defpieces (&rest pieces) `(progn ,@(loop for piece in pieces for i from 0 collect `(defconstant ,piece ,i))))
<saturn2> i wouldn't recommend it though
<buffet> aight, thanks!
igemnace has joined #commonlisp
vxe420 has quit [Quit: ZNC 1.8.2+deb2build5 - https://znc.in]
vxe420 has joined #commonlisp
<beach> Even so, having an array indexed by pieces is kind of the inside-out representation. If a position is associated with a piece, it should be part of the representation of the piece. The array representation also makes low-level assumptions about the representation of a piece which is a bad idea.
<beach> Imagine if you then want to encode legal moves for a piece. Then you need yet another array. And if you want to have a picture of a piece, another array, etc.
<buffet> well, classic aos vs soa
<beach> minion: What does AOS stand for?
<minion> Axilla Oafishness Speckfall
<sweatshirt> sbcl over clisp for now; sbcl supports lass
<jcowan> The Sapir-Whorf hypothesis of programming languages
<beach> buffet: And even in C, using enums and an array, you would define a function position(piece) so that only that function needs to be changed when the representation changes.
szkl has quit [Quit: Connection closed for inactivity]
attila_lendvai has quit [Ping timeout: 255 seconds]
rtoy has quit [Quit: rtoy]
eddof13 has joined #commonlisp
X-Scale has quit [Quit: Client closed]
aartaka has joined #commonlisp
azimut has quit [Ping timeout: 255 seconds]
masinter has quit [Ping timeout: 252 seconds]
aartaka has quit [Ping timeout: 255 seconds]
X-Scale has joined #commonlisp
bjorkintosh has quit [Quit: Leaving]
bjorkintosh has joined #commonlisp
bjorkintosh has joined #commonlisp
bjorkintosh has quit [Changing host]
aartaka has joined #commonlisp
aartaka has quit [Ping timeout: 255 seconds]
luis9 is now known as luis
<sweatshirt> anyone using henchentoot and lass know how to access :hover for css?
<sweatshirt> like a:hover {}
masinter has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
pranavats has left #commonlisp [Error from remote client]
Inline has joined #commonlisp
dmgk has quit [Quit: ZNC - https://znc.in]
dmgk has joined #commonlisp
pranavats has joined #commonlisp
<Shinmera> ((:and a :hover) ...)
<Shinmera> or ("a:hover" ...)
inline__ has joined #commonlisp
Inline has quit [Ping timeout: 248 seconds]
<sweatshirt> i see.. that first method hadn't worked for me but ill give it another shot thank you!
<Shinmera> you can plainly see that it does. (lass:compile-and-write '((:and a :hover) :x y))
<sweatshirt> okay; i was just saying that when i did that prior to asking; the result wasn't what was expected. I fixed it by fixing a typo -- thanks nonetheless!
tyson2 has joined #commonlisp
X-Scale has quit [Quit: Client closed]
waleee has joined #commonlisp
inline__ has quit [Ping timeout: 246 seconds]
amoroso has joined #commonlisp
amoroso has quit [Quit: Client closed]
eddof13 has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
eddof13 has joined #commonlisp
amoroso has joined #commonlisp
eddof13 has quit [Ping timeout: 246 seconds]
McParen has joined #commonlisp
glaucon has quit [Read error: Connection reset by peer]
occ has quit [Ping timeout: 255 seconds]
Guest63 has quit [Quit: Client closed]
amoroso has quit [Quit: Client closed]
occ has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
amoroso has joined #commonlisp
<Shinmera> etimmons: Any chance of getting a reply to https://github.com/Shinmera/parachute/issues/39#issuecomment-1272374545 ?
<ixelp> xunit xml reporting · Issue #39 · Shinmera/parachute · GitHub
morganw has joined #commonlisp
igemnace has quit [Remote host closed the connection]
Lycurgus has quit [Ping timeout: 255 seconds]
akoana has joined #commonlisp
tyson2 has joined #commonlisp
amoroso has quit [Quit: Client closed]
kevingal has quit [Ping timeout: 268 seconds]
azimut has joined #commonlisp
sjl_ has quit [Quit: WeeChat 3.6]
cage has quit [Quit: rcirc on GNU Emacs 28.2]
sweatshirt has quit [Remote host closed the connection]
_cymew_ has quit [Ping timeout: 255 seconds]
samedi has joined #commonlisp
McParen has left #commonlisp [#commonlisp]
jmdaemon has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
waleee has quit [Ping timeout: 246 seconds]
waleee has joined #commonlisp
kevingal has joined #commonlisp
random-jellyfish has joined #commonlisp
<random-jellyfish> is there a way to make the common lisp debugger display line number when an error is brought up?
<random-jellyfish> I can't understand where the error comes from
tyson2 has joined #commonlisp
<splittist> random-jellyfish: if you're in Slime you can hit 'v' to take you to the form
<pjb> random-jellyfish: ^ yes ; otherwise the notion of line number cannot be defined precisely or easily with lisp, given macros, etc.
<random-jellyfish> thanks, works in sly too
aartaka has joined #commonlisp
<pjb> random-jellyfish: observe also the stack of frames in sldb.
<pjb> random-jellyfish: typing RET on a frame will display the local variables and parameters; this should help debugging too.
<random-jellyfish> yeah I use that too from time to time
<random-jellyfish> debugging is very different in common lisp than other language, but at least the language is powerful
aartaka has quit [Ping timeout: 255 seconds]
morganw has quit [Remote host closed the connection]
Lycurgus has joined #commonlisp
Lycurgus has quit [Changing host]
Lycurgus has joined #commonlisp
samedi has quit [Read error: Connection reset by peer]
rgherdt has quit [Remote host closed the connection]
<mfiano> Also noteworthy is C-u C-c C-c on a form, to recompile it with the debug optimization quality set to 3, and there is the same for when you're already in the debugger window, but I forget what it is bound to by default.
waleee has quit [Ping timeout: 252 seconds]
waleee has joined #commonlisp
pawa2 has joined #commonlisp
Lycurgus has quit [Ping timeout: 255 seconds]
akoana has quit [Quit: leaving]