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/>
azimut has quit [Ping timeout: 252 seconds]
Lord_of_Life has quit [Ping timeout: 252 seconds]
Lord_of_Life has joined #commonlisp
random-jellyfish has quit [Quit: Client closed]
azimut has joined #commonlisp
NicknameJohn has quit [Ping timeout: 240 seconds]
Lord_of_Life has quit [Ping timeout: 258 seconds]
molson has joined #commonlisp
Lord_of_Life has joined #commonlisp
NicknameJohn has joined #commonlisp
hrberg has quit [Ping timeout: 255 seconds]
hrberg has joined #commonlisp
NicknameJohn has quit [Ping timeout: 244 seconds]
bjorkint0sh has quit [Ping timeout: 258 seconds]
tboros has quit [Ping timeout: 245 seconds]
bjorkint0sh has joined #commonlisp
rtypo has quit [Ping timeout: 244 seconds]
ns12 has joined #commonlisp
NicknameJohn has joined #commonlisp
tibfulv has quit [Remote host closed the connection]
yitzi has quit [Remote host closed the connection]
tibfulv has joined #commonlisp
jmdaemon has joined #commonlisp
shoggouth has quit [Quit: Connection closed for inactivity]
tboros has joined #commonlisp
b00p has joined #commonlisp
jonatack has joined #commonlisp
azimut has quit [Ping timeout: 252 seconds]
wonko-the-sane has quit [Quit: leaving]
edr has quit [Quit: Leaving]
tyson2 has quit [Remote host closed the connection]
amb007 has quit [Ping timeout: 240 seconds]
amb007 has joined #commonlisp
b00p has quit [Quit: Leaving.]
tboros has quit [Ping timeout: 245 seconds]
copec has quit [Ping timeout: 245 seconds]
anticrisis has joined #commonlisp
b00p has joined #commonlisp
copec has joined #commonlisp
b00p has quit [Quit: Leaving.]
wonko-the-sane has joined #commonlisp
abrantesasf has joined #commonlisp
kstuart has joined #commonlisp
b00p has joined #commonlisp
pfdietz has quit [Quit: Client closed]
bilegeek has joined #commonlisp
_whitelogger has joined #commonlisp
semarie has quit [Ping timeout: 258 seconds]
abrantesasf has quit [Remote host closed the connection]
thuna` has quit [Remote host closed the connection]
b00p has quit [Quit: Leaving.]
pranavats has joined #commonlisp
shka has joined #commonlisp
puke has joined #commonlisp
son0p has quit [Ping timeout: 240 seconds]
NicknameJohn has quit [Ping timeout: 244 seconds]
tboros has joined #commonlisp
anticrisis has quit [Read error: Connection reset by peer]
jjnkn has joined #commonlisp
rainthree has joined #commonlisp
tboros has quit [Ping timeout: 245 seconds]
anticrisis has joined #commonlisp
dcb has quit [Quit: MSN Messenger 4.0.4]
shka has quit [Ping timeout: 258 seconds]
jjnkn has quit [Ping timeout: 260 seconds]
attila_lendvai has joined #commonlisp
NicknameJohn has joined #commonlisp
pranavats has left #commonlisp [Disconnected: Hibernating too long]
pve has joined #commonlisp
White_Flame has quit [Remote host closed the connection]
tboros has joined #commonlisp
jmd_ has joined #commonlisp
White_Flame has joined #commonlisp
jmdaemon has quit [Read error: Connection reset by peer]
son0p has joined #commonlisp
tboros has quit [Ping timeout: 245 seconds]
semarie has joined #commonlisp
pranavats has joined #commonlisp
semarie_ has joined #commonlisp
semarie is now known as Guest7613
semarie_ is now known as semarie
Guest7613 has quit [Killed (tungsten.libera.chat (Nickname regained by services))]
attila_lendvai has quit [Ping timeout: 264 seconds]
rgherdt has joined #commonlisp
zxcvz has joined #commonlisp
tboros has joined #commonlisp
bilegeek has quit [Quit: Leaving]
habamax has joined #commonlisp
tboros has quit [Ping timeout: 245 seconds]
semarie has quit [Ping timeout: 246 seconds]
semarie has joined #commonlisp
dino_tutter has joined #commonlisp
semarie has quit [Ping timeout: 252 seconds]
semarie has joined #commonlisp
semarie is now known as Guest9352
semarie_ has joined #commonlisp
Guest9352 has quit [Killed (osmium.libera.chat (Nickname regained by services))]
semarie_ has joined #commonlisp
semarie is now known as Guest2812
semarie_ is now known as semarie
markb1 has quit [Ping timeout: 258 seconds]
amb007 has quit [Ping timeout: 264 seconds]
amb007 has joined #commonlisp
Inline has quit [Quit: Leaving]
Inline has joined #commonlisp
tboros has joined #commonlisp
amb007 has quit [Ping timeout: 258 seconds]
amb007 has joined #commonlisp
zxcvz has quit [Remote host closed the connection]
thollief has joined #commonlisp
random-nick has joined #commonlisp
anticrisis has quit [Read error: Connection reset by peer]
rainthree has quit [Ping timeout: 240 seconds]
semarie has quit [Quit: WeeChat 4.0.4]
semarie has joined #commonlisp
cstub has joined #commonlisp
cognemo has joined #commonlisp
dino_tutter has quit [Remote host closed the connection]
dino_tutter has joined #commonlisp
rtypo has joined #commonlisp
dino_tutter has quit [Ping timeout: 258 seconds]
igemnace has joined #commonlisp
karlosz has joined #commonlisp
tboros has quit [Ping timeout: 245 seconds]
pfdietz has joined #commonlisp
epolanski has joined #commonlisp
NicknameJohn has quit [Ping timeout: 264 seconds]
NicknameJohn has joined #commonlisp
flip214 has quit [Read error: Connection reset by peer]
rainthree has joined #commonlisp
flip214 has joined #commonlisp
azimut has joined #commonlisp
semarie has quit [Quit: WeeChat 4.0.4]
lucasta_ has joined #commonlisp
lucasta_ has quit [Client Quit]
semarie has joined #commonlisp
karlosz has quit [Remote host closed the connection]
attila_lendvai has joined #commonlisp
notzmv has quit [Ping timeout: 264 seconds]
akoana has joined #commonlisp
cage has joined #commonlisp
rainthree3 has joined #commonlisp
random-jellyfish has joined #commonlisp
attila_lendvai has quit [Ping timeout: 245 seconds]
yitzi has joined #commonlisp
habamax has quit [Remote host closed the connection]
jjnkn has joined #commonlisp
cstub has quit [Quit: Leaving]
dcb has joined #commonlisp
rainthree has quit [Quit: Leaving]
tyson2 has joined #commonlisp
haoms has joined #commonlisp
rainthree3 is now known as rainthree
<haoms> hey all, what is the usual way to add new elements to a 2D array? in a simply 1D array i just use vector-push, but how would i add a new element to a 2d array, and thus possibly extend the array by adding a new row?
<beach> ::clhs adjust-array
<ixelp> CLHS: Function ADJUST-ARRAY
cage has quit [Quit: rcirc on GNU Emacs 29.1]
<haoms> i know of adjust-array, but how would I push a new item to it?
<beach> It makes no sense to push an item to a 2D array. Where would it go?
<haoms> at the end of it, the same way vector-push does it for a vector?
<beach> So then the last row would not have the same number of elements as the preceding ones?
<haoms> no, a new row would be started.
<beach> Or if you then add an entire row, and then push another element, would that add yet another row?
<haoms> yes, if i have #2a((1 2)(3 4)) and then push 5, i should end up with #2a((1 2)(3 4)(5 0))
<beach> So then, when you push 6, you would get #2a((1 2)(3 4)(5 0)(6 0)).
<beach> There is no concepts of an unbound element in an array, so there is no way to tell that all but one element in the last row are "unused".
<haoms> okay, that answer makes sense.
<beach> Great.
<haoms> well, thanks, i didnt expect that, but thanks.
<beach> Sure.
<mfiano> You more than likely want a rank-1 array in there somewhere, maybe even displaced to from the rank-2 one... with what you're done
<haoms> :)
<haoms> mfiano: i imagined pushing elements to the 1d vector, then converting to a 2d array.
<mfiano> converting when?
<haoms> when i'm done pushing.
<mfiano> And why would you allocate an increasing amount of space on each push?
<haoms> i dont really know how many rows i will end up, i just know the number of columns.
<haoms> i want to add elements in row-major-order.
akoana has left #commonlisp [Leaving]
<mfiano> Ok, so there's adjust-array
<haoms> pushing to a vector and then converting to a 2d array seems for me the easiest way to do that, but converting a vector to a 2d array doesnt seem to work with adjust-array.
<mfiano> You can simulate pushing with an amortized space cost
cage has joined #commonlisp
<mfiano> That was pointed out to you though, so I assume you are aware of the better solutions
<haoms> Do you know why converting a vector to a 2d array is not possible here: (adjust-array (make-array 6) '(3 2))
<haoms> no, i am not yet aware of a complete solution because adjust-array doesnt seem to be able to convert between arrays of different ranks
<haoms> and displace-to doesnt work if a vector of length 5 is converted to a 3x2 array.
<haoms> so you have no neat idea how to do that?
notzmv has joined #commonlisp
rainthree has quit [Quit: Leaving]
random-jellyfish has quit [Quit: Client closed]
epolanski has quit [Quit: Connection closed for inactivity]
yitzi has quit [Ping timeout: 258 seconds]
yitzi has joined #commonlisp
b00p has joined #commonlisp
jello_pudding has quit [Ping timeout: 260 seconds]
jello_pudding has joined #commonlisp
igemnace has quit [Read error: Connection reset by peer]
gamaliel has joined #commonlisp
<jcowan> A more rational implementation of pushing to an array would be that what you push to an array of rank $r$ is another array of rank $r-1, with the exception that a non-array is treated as an array of rank 0.
b00p has quit [Quit: Leaving.]
b00p has joined #commonlisp
chomwitt has joined #commonlisp
jmd_ has quit [Ping timeout: 255 seconds]
igemnace has joined #commonlisp
MajorBiscuit has joined #commonlisp
MajorBiscuit has quit [Client Quit]
tyson2 has quit [Remote host closed the connection]
gamaliel has quit [Quit: Client closed]
waleee has joined #commonlisp
azimut has quit [Ping timeout: 252 seconds]
b00p has quit [Quit: Leaving.]
lagash has quit [Ping timeout: 240 seconds]
b00p has joined #commonlisp
triffid has quit [Quit: triffid]
<johnjaye> what is "flexistreams"? I installed "str" in the tutorial and it installed thta as a dep
<ixelp> FLEXI-STREAMS - Flexible bivalent streams for Common Lisp
<johnjaye> ok. it seems strange you'd need a stream library to use strings.
amb007 has quit [Ping timeout: 248 seconds]
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 258 seconds]
<yitzi> johnjaye: streams can output to strings
b00p has quit [Quit: Leaving.]
<edgar-rft> johnjaye: Common Lisp has string-streams
<edgar-rft> ::clhs string-stream
<ixelp> CLHS: System Class STRING-STREAM
azimut has joined #commonlisp
wonko-the-sane has quit [Ping timeout: 252 seconds]
gxt has quit [Ping timeout: 252 seconds]
gxt has joined #commonlisp
yitzi has quit [Ping timeout: 244 seconds]
yitzi has joined #commonlisp
igemnace has quit [Quit: WeeChat 4.0.4]
amb007 has joined #commonlisp
tyson2 has joined #commonlisp
hirez has quit [Ping timeout: 244 seconds]
b00p has joined #commonlisp
Inline has quit [Quit: Leaving]
haoms has quit [Ping timeout: 255 seconds]
hirez has joined #commonlisp
Inline has joined #commonlisp
waleee has quit [Ping timeout: 240 seconds]
waleee has joined #commonlisp
lagash has joined #commonlisp
McParen has joined #commonlisp
dcb has quit [Quit: MSN Messenger 4.0.4]
tyson2 has quit [Ping timeout: 258 seconds]
amb007 has quit [Ping timeout: 240 seconds]
b00p has quit [Quit: Leaving.]
b00p has joined #commonlisp
cstub has joined #commonlisp
cstub has quit [Remote host closed the connection]
McParen has left #commonlisp [#commonlisp]
b00p has quit [Quit: Leaving.]
amb007 has joined #commonlisp
b00p has joined #commonlisp
cstub has joined #commonlisp
b00p has quit [Quit: Leaving.]
jjnkn has quit [Quit: leaving]
tyson2 has joined #commonlisp
thollief has quit [Quit: Leaving]
thuna` has joined #commonlisp
<phantomics> haoms: if you're still around, this approach to adding things to arrays will be very slow
<phantomics> nonetheless, one way to do it would be to vector-push the elements to a vector, then displace the vector to a matrix whose height will grow depending on the number of items in the matrix
<phantomics> For example, if your matrix will be 3 wide, you can find the height by doing (ceiling n 3) where n is the current number of elements in the matrix
<phantomics> Actually, displacement won't work with a smaller array. What you'll need to do is create a new matrix each time, initialize its elements to 0 then iterate over the vector and for each element e indexed by i do (setf (row-major-aref matrix i) e)
<phantomics> It's very ineffiencient, best to find another way to accomplish what you're trying to do
tyson2 has quit [Remote host closed the connection]
Inline has quit [Quit: Leaving]
markb1 has joined #commonlisp
rgherdt_ has joined #commonlisp
rgherdt has quit [Ping timeout: 240 seconds]
tboros has joined #commonlisp
<jcowan> phantomics: I don't understand why you can't make a displaced array that accesses an adjustable array.
<phantomics> It's a memory thing, if you change the adjustable array then there's some ambiguity over where the displaced array will point to
tyson2 has joined #commonlisp
<phantomics> Also the adjustable arrays are probably going to be implemented in practice by automatically allocating new memory blocks and copying from the prior array state, this may mess with the mechanics of displaced arrays
cage has quit [Quit: rcirc on GNU Emacs 29.1]
dino_tutter has joined #commonlisp
tboros has quit [Ping timeout: 245 seconds]
rgherdt_ has quit [Quit: Leaving]
xmachina has quit [Quit: WeeChat 4.0.4]
vjalmr has quit [Ping timeout: 244 seconds]
Brucio-61 has quit [Remote host closed the connection]
Brucio-61 has joined #commonlisp
xmachina has joined #commonlisp
b00p has joined #commonlisp
chomwitt has quit [Ping timeout: 264 seconds]
xmachina has quit [Quit: WeeChat 4.0.4]
dino_tutter has quit [Ping timeout: 240 seconds]
anticrisis has joined #commonlisp
habamax has joined #commonlisp
kevingal has joined #commonlisp
b00p has quit [Quit: Leaving.]
rbcarleton has joined #commonlisp
<jcowan> phantomics: mmm, I see, thanks
<phantomics> It occurs to me that a big reason to have adjustable arrays as a distinct type at all is so that you can have displaced arrays. If an array is not adjustable, you implement the displaced array just by having it point to the same storage location.
<phantomics> If an array is adjustable, you would need to track all displaced arrays pointing to it and update them when the adjustable array is changed. Also that adjustable array could be changed in a way that's incompatible with its displaced array(s) and what then?
NicknameJohn has quit [Ping timeout: 244 seconds]
xmachina has joined #commonlisp
habamax has quit [Remote host closed the connection]