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/>
jla has joined #commonlisp
Pixel_Outlaw has quit [Remote host closed the connection]
X-Scale has joined #commonlisp
jla has quit [Quit: Client closed]
donleo has quit [Ping timeout: 268 seconds]
Oladon has quit [Quit: Leaving.]
Renfield has quit [Server closed connection]
Renfield has joined #commonlisp
Kingsy has joined #commonlisp
<Kingsy> anyone around?
<inline> yes
X-Scale has quit [Quit: Client closed]
<Kingsy> I was hoping to get some advice on this code -> https://bpa.st/I2KA <- it works just fine, but if I pass a ^C character into the stream. then it crashes. Which is kinda to be expected (given I am raising the error up then closing the socket and exiting) BUT if I attempt to just continue after the first error in serve-client, I am no longer able to write into the stream. no errors just no output to the
<ixelp> View paste I2KA
<Kingsy> stream but the code is executing... I really don't understand it. its like ^C is doing something special I don't understand
<Kingsy> the error is -> UTF-8 stream decoding error <- and it only happens fro ^C, ^B, ^L etc etc all fine. ^C is special
<Kingsy> so, thats a long way of saying, why cant I just catch an error like that in the serve-client function, and just continue on reading from and writing into the stream. the code works perfectly before the ^C and is dead after. any advice would be most welcome!
makomo has quit [Ping timeout: 268 seconds]
luna-is-here has quit [Remote host closed the connection]
certainty has joined #commonlisp
X-Scale has joined #commonlisp
luna-is-here has joined #commonlisp
certainty has quit [Ping timeout: 256 seconds]
rtypo has joined #commonlisp
habamax has quit [Remote host closed the connection]
habamax has joined #commonlisp
dnhester26 has joined #commonlisp
notzmv has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
yitzi has quit [Remote host closed the connection]
certainty has joined #commonlisp
certainty has quit [Ping timeout: 256 seconds]
Gleefre has joined #commonlisp
tyson2 has joined #commonlisp
habamax has quit [Ping timeout: 256 seconds]
rtypo has quit [Ping timeout: 240 seconds]
certainty has joined #commonlisp
certainty has quit [Ping timeout: 256 seconds]
pfdietz has quit [Quit: Client closed]
notzmv has quit [Ping timeout: 256 seconds]
habamax has joined #commonlisp
contrapunctus has joined #commonlisp
avocadoist has quit [Ping timeout: 246 seconds]
tyson2 has quit [Remote host closed the connection]
certainty has joined #commonlisp
certainty has quit [Ping timeout: 240 seconds]
eddof13 has joined #commonlisp
edr has quit [Quit: Leaving]
notzmv has joined #commonlisp
pve has quit [Ping timeout: 240 seconds]
X-Scale has quit [Quit: Client closed]
eddof13 has quit [Ping timeout: 252 seconds]
pve has joined #commonlisp
certainty has joined #commonlisp
bh34e5 has quit [Ping timeout: 268 seconds]
certainty has quit [Ping timeout: 268 seconds]
cstml has quit [Read error: Connection reset by peer]
mxmkm has joined #commonlisp
notzmv has quit [Ping timeout: 268 seconds]
habamax has quit [Ping timeout: 260 seconds]
mxmkm has quit [Remote host closed the connection]
habamax has joined #commonlisp
<oak> Kingsy: i kinda wonder whether it's just the stream responding to the process getting a SIGINT? an experiment might be to generate a SIGINT externally using kill(1) to see if it produces the same issue, to see if it's ^C the input that's the issue or the signal itself
certainty has joined #commonlisp
habamax has quit [Remote host closed the connection]
habamax has joined #commonlisp
certainty has quit [Ping timeout: 260 seconds]
<gilberth> Kingy: Use nc(1) to test your socket not telnet(1).
<gilberth> * Kingsy
certainty has joined #commonlisp
certainty has quit [Ping timeout: 256 seconds]
dcb has quit [Ping timeout: 260 seconds]
dcb has joined #commonlisp
dcb has quit [Client Quit]
certainty has joined #commonlisp
notzmv has joined #commonlisp
contrapunctus has left #commonlisp [#commonlisp]
contrapunctus has joined #commonlisp
habamax has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.1)]
rgherdt has joined #commonlisp
rgherdt_ has joined #commonlisp
igemnace has joined #commonlisp
rgherdt has quit [Ping timeout: 256 seconds]
rgherdt has joined #commonlisp
rgherdt_ has quit [Ping timeout: 260 seconds]
shka has joined #commonlisp
waleee has quit [Ping timeout: 245 seconds]
pfdietz has joined #commonlisp
chomwitt has joined #commonlisp
treflip has joined #commonlisp
thollief has joined #commonlisp
kevingal has joined #commonlisp
bendersteed has joined #commonlisp
kevingal has quit [Read error: Connection reset by peer]
kevingal has joined #commonlisp
cstml has joined #commonlisp
cdegroot has quit [Server closed connection]
cdegroot has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 268 seconds]
zetef has joined #commonlisp
Lord_of_Life_ is now known as Lord_of_Life
dino_tutter has joined #commonlisp
kevingal has quit [Remote host closed the connection]
anticrisis has quit [Read error: Connection reset by peer]
mgl_ has joined #commonlisp
luis has quit [Ping timeout: 240 seconds]
habamax has joined #commonlisp
bendersteed has quit [Remote host closed the connection]
igemnace has quit [Read error: Connection reset by peer]
donleo has joined #commonlisp
zetef has quit [Ping timeout: 246 seconds]
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
igemnace has joined #commonlisp
grinton has quit [Server closed connection]
grinton has joined #commonlisp
santiagopim has quit [Remote host closed the connection]
habamax has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.1.90)]
luis has joined #commonlisp
zetef has joined #commonlisp
habamax has joined #commonlisp
rgherdt_ has joined #commonlisp
rgherdt has quit [Read error: Connection reset by peer]
rgherdt__ has joined #commonlisp
puke has joined #commonlisp
danse-nr3 has joined #commonlisp
rgherdt_ has quit [Ping timeout: 268 seconds]
msavoritias has joined #commonlisp
<Kingsy> ok will try both of these. I mean is it a good thing that ^c terminates the stream? perhaps that is functionality I need to include.
contrapunctus has left #commonlisp [#commonlisp]
danse-nr3 has quit [Read error: Connection reset by peer]
danse-nr3 has joined #commonlisp
contrapunctus has joined #commonlisp
_death has quit [Server closed connection]
adeht has joined #commonlisp
larix has joined #commonlisp
larix1 has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
zetef has quit [Ping timeout: 246 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
makomo has joined #commonlisp
rgherdt__ has quit [Remote host closed the connection]
rgherdt__ has joined #commonlisp
nytpu has quit [Server closed connection]
nytpu has joined #commonlisp
Gleefre has quit [Ping timeout: 250 seconds]
dnhester26 has joined #commonlisp
tyson2 has joined #commonlisp
avocadoist has joined #commonlisp
<Kingsy> oak: when you say use "kill" what do you propose to kill? the connection to the stream? or the server? I am actually not sure how this test tells us anything.
Gleefre has joined #commonlisp
hirez has quit [Server closed connection]
hirez has joined #commonlisp
chomwitt has quit [Ping timeout: 256 seconds]
cstml has quit [Quit: WeeChat 2.3]
thuna` has quit [Read error: Connection reset by peer]
cstml has joined #commonlisp
chomwitt has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
yitzi has joined #commonlisp
jonatack has quit [Ping timeout: 268 seconds]
rtypo has joined #commonlisp
habamax has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.1.90)]
danse-nr3 has quit [Ping timeout: 256 seconds]
edr has joined #commonlisp
larix1 has quit [Ping timeout: 256 seconds]
larix has quit [Ping timeout: 268 seconds]
danse-nr3 has joined #commonlisp
larix1 has joined #commonlisp
larix has joined #commonlisp
danse-nr3 has quit [Ping timeout: 268 seconds]
lucasta has joined #commonlisp
danse-nr3 has joined #commonlisp
danse-nr3 has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
cage has joined #commonlisp
danse-nr3 has quit [Ping timeout: 246 seconds]
danse-nr3 has joined #commonlisp
random-nick has joined #commonlisp
pfdietz has quit [Quit: Client closed]
danse-nr3 has quit [Read error: Connection reset by peer]
danse-nr3 has joined #commonlisp
jmdaemon has quit [Ping timeout: 268 seconds]
kevingal has joined #commonlisp
jonatack has joined #commonlisp
contrapunctus has left #commonlisp [#commonlisp]
dnhester26 has quit [Remote host closed the connection]
contrapunctus has joined #commonlisp
notzmv has quit [Ping timeout: 268 seconds]
larix has quit [Ping timeout: 268 seconds]
larix1 has quit [Ping timeout: 256 seconds]
tyson2 has quit [Ping timeout: 256 seconds]
dnhester26 has joined #commonlisp
masinter has quit [Remote host closed the connection]
dnhester26 has quit [Ping timeout: 256 seconds]
dnhester26 has joined #commonlisp
kevingal_ has joined #commonlisp
qhong has quit [Read error: Connection reset by peer]
qhong has joined #commonlisp
pve has quit [Read error: Connection reset by peer]
contrapunctus has left #commonlisp [#commonlisp]
kagevf has joined #commonlisp
danse-nr3 has quit [Ping timeout: 256 seconds]
tyson2 has joined #commonlisp
pve has joined #commonlisp
contrapunctus has joined #commonlisp
shka has quit [Ping timeout: 246 seconds]
edgar-rft has quit [Ping timeout: 245 seconds]
edgar-rft has joined #commonlisp
shka has joined #commonlisp
larix1 has joined #commonlisp
larix has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
danse-nr3 has joined #commonlisp
fe[nl]ix has quit [Server closed connection]
fe[nl]ix has joined #commonlisp
lucasta has quit [Quit: Leaving]
yitzi has quit [Remote host closed the connection]
jaimelm has quit [Server closed connection]
jaimelm has joined #commonlisp
sjl has joined #commonlisp
dcb has joined #commonlisp
igemnace has quit [Remote host closed the connection]
dnhester26 has quit [Remote host closed the connection]
notzmv has joined #commonlisp
dino_tutter has quit [Ping timeout: 256 seconds]
inline has quit [Quit: Leaving]
inline has joined #commonlisp
waleee has joined #commonlisp
larix1 has quit [Ping timeout: 246 seconds]
larix has quit [Ping timeout: 268 seconds]
ns12 has quit [Server closed connection]
ns12 has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
<lispmacs[work]> Hi, i am working on a terminal emulator project for a legacy terminal type, and was using SBCL. So, I'm learning more about posix termios (in general) and also sb-posix (for SBCL). Something that confuses me a bit is how "the terminal", mentioned by the termios class documentation, relates to the various i/o streams in my application.
<lispmacs[work]> e.g., if I open a stream to read data from a serial port device, do I set termios settings for that stream, or am totally misunderstanding this?
<lispmacs[work]> I want to be able to adjust the read timeouts and such for reads from the serial port device
yitzi has joined #commonlisp
larix has joined #commonlisp
larix1 has joined #commonlisp
dnhester26 has joined #commonlisp
Gleefre has joined #commonlisp
dnhester26 has quit [Client Quit]
<lispmacs[work]> hmm, so do termios instances just affect the *TERMINAL-IO* object, or...?
<lispmacs[work]> or do termios instances get passed to something?
waleee has quit [Quit: WeeChat 4.1.0]
attila_lendvai has joined #commonlisp
<bike> *terminal-io* doesn't have to have anything to do with your terminal emulator program or termios. *terminal-io* is just your repl console, basically, whatever that means.
<lispmacs[work]> okay
larix1 has quit [Ping timeout: 256 seconds]
larix has quit [Ping timeout: 256 seconds]
<gilberth> A terminal emulator would use the other end of a pseudo tty to which all those termios settings don't apply. It's just a "raw" binary stream.
tyson2 has quit [Remote host closed the connection]
<lispmacs[work]> okay, so say in my program I want to open a serial comm device file, say ttyUSB0, that represents say an RS232 connection, and then change termios settings for that (like read timeout), then read data from that, can I do this all with common lisp / SBCL streams, or...?
danse-nr3 has quit [Read error: Connection reset by peer]
<gilberth> Oh, you want to talk to an actual serial port?
<lispmacs[work]> I don't see the way to control termios settings in common lisp generally. SBCL has sb-posix
<lispmacs[work]> but all I see is a termios class for specifying termios settings
danse-nr3 has joined #commonlisp
<lispmacs[work]> but it doesn't explain what you are supposed to do with the termios instance
<gilberth> There are no standard CL functions for doing that. You would need some implementation dependent means.
sjl has quit [Ping timeout: 268 seconds]
<gilberth> You would need to dive into UNIX. What you want is cfmakeraw(3).
<lispmacs[work]> but I don't have to code this in C do I? I can't be the first common lisp user to want to talk to a serial port. I'm trying to figure out if SBCL by itself provides the functionality for it, or if I'm going to need some other POSIX library for that, or...
ec_ is now known as ec
<lispmacs[work]> I see termios class in sb-posix but I don't see how it relates to devices or streams
<lispmacs[work]> practically speaking
<lispmacs[work]> or is sb-posix just some kind of FFI?
<gilberth> A quick fix for you is to run "stty raw </dev/ttyUSB0" as external program to make your serial device raw, which is what you want. or "stty 9600 </dev/ttyUSB0" to set the baudrate.
<gilberth> There is no shortcut, you really need to dig into UNIX here. Though CCL has a library for setting up serial lines (termios settings).
<lispmacs[work]> I'm looking at sbcl-trivial-raw-io
<lispmacs[work]> it looks like it uses sb-posix
<gilberth> Otherwise, get hold of the fd, call tcgetattr(3) to get the current termios settings, use e.g. cfmakeraw(3) or cfsetspeeed(3) to modify it an then do a tcsetattr(3). Whatever FFI or POSIX wrapper your implementation provides.
<lispmacs[work]> the documentation is rather scarce, but it seems to somehow tie together that a streams with a macro and stream functions
johnjaye has quit [Server closed connection]
mgl_ has quit [Ping timeout: 256 seconds]
johnjaye has joined #commonlisp
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #commonlisp
<lispmacs[work]> is there a way in the repl to see all the objects exported by a package?
<Shinmera> packages export symbols. is that what you mean, or?
<lispmacs[work]> yes.
<Shinmera> ::clhs do-external-symbols
<Colleen> Clhs: macro do-symbols, do-external-symbols... https://www.lispworks.com/documentation/HyperSpec/Body/m_do_sym.htm
<ixelp> CLHS: Macro DO-SYMBOLS, DO-EXTERNAL-SYMBOLS...
<lispmacs[work]> is there a function for getting the package object for a package, so I can inspect it?
<Shinmera> ::clhs find-package
<ixelp> CLHS: Function FIND-PACKAGE
<lispmacs[work]> too easy
<Shinmera> ?
<lispmacs[work]> I meant that was easier than I expected, thank you
<Shinmera> for future reference, you can easily search for things on here https://www.lispworks.com/documentation/HyperSpec/Front/X_AllSym.htm
<ixelp> CLHS: Alphabetical Symbol Index (Full)
dino_tutter has joined #commonlisp
<lispmacs[work]> okay, thanks, though I think this slime-hyperspec-lookup function is probably more convenient
<Shinmera> or (apropos "package" :cl)
<lispmacs[work]> which I should ahve used first before asking
<lispmacs[work]> slime-inspect in conjunction with find-package will show me all the symbols, I see
hineios2 has quit [Server closed connection]
hineios2 has joined #commonlisp
<lispmacs[work]> okay, so it looks like sb-posix has function like OPEN, and such
<lispmacs[work]> and tons of other posixy stuff
<lispmacs[work]> the just aren't documented/listed out in the SBCL reference manual
larix1 has joined #commonlisp
larix has joined #commonlisp
tyson2 has joined #commonlisp
waleee has joined #commonlisp
sjl has joined #commonlisp
sjl has quit [Ping timeout: 256 seconds]
sjl has joined #commonlisp
tyson2 has quit [Ping timeout: 268 seconds]
larix1 has quit [Ping timeout: 256 seconds]
larix has quit [Ping timeout: 268 seconds]
phoe has quit [Server closed connection]
phoe has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
danse-nr3 has quit [Ping timeout: 268 seconds]
danse-nr3 has joined #commonlisp
mgl_ has joined #commonlisp
Guest63 has joined #commonlisp
<Guest63> Hello there everyone, I wonder if there is apropos in Clozure CL and if there is how to use it to see documentation on functions and vars
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<Guest63> O no, apropos and describe work as expected! Funny thing, before trying it I ask questions!
mgl_ has quit [Ping timeout: 260 seconds]
dstein64 has quit [Server closed connection]
dstein64 has joined #commonlisp
certainty has quit [Ping timeout: 256 seconds]
larix has joined #commonlisp
larix1 has joined #commonlisp
sjl has quit [Ping timeout: 246 seconds]
<semz> Guest63: apropos and describe are in the standard even, so they're available on all conforming impls
<semz> quality of output might vary though
akoana has joined #commonlisp
theBlackDragon has quit [Server closed connection]
theBlackDragon has joined #commonlisp
certainty has joined #commonlisp
<fourier> lispmacs[work]: fwiw LispWorks has serial port support, if cost is not a problem: https://www.lispworks.com/documentation/lw80/lw/lw-serial-port.htm
<ixelp> 44 The SERIAL-PORT Package
thollief has quit [Ping timeout: 268 seconds]
thollief has joined #commonlisp
certainty has quit [Ping timeout: 268 seconds]
anticrisis has joined #commonlisp
<yitzi> There is also the cserial-port system in quicklisp.
prokhor has quit [Remote host closed the connection]
Guest63 has quit [Quit: Client closed]
doyougnu- has quit [Server closed connection]
doyougnu has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
triffid has quit [Remote host closed the connection]
msavoritias has quit [Ping timeout: 256 seconds]
triffid has joined #commonlisp
mgl_ has joined #commonlisp
amb007 has quit [Ping timeout: 245 seconds]
kevingal has quit [Ping timeout: 256 seconds]
kevingal_ has quit [Ping timeout: 268 seconds]
amb007 has joined #commonlisp
Oladon has joined #commonlisp
treflip has quit [Quit: Quit]
jmdaemon has joined #commonlisp
certainty has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
tyson2 has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 29.1]
certainty has quit [Ping timeout: 245 seconds]
<Kingsy> yeah I cant reproduce the issue with nc rather than telnet. ^C on nc actually terminates the connection to the stream and doesnt send the character. I mean perhaps I don't care about this.
gpiero has quit [Server closed connection]
<Kingsy> it just feels weird.
gpiero has joined #commonlisp
<Kingsy> anyone kicking around for a conversation?
<Kingsy> hmm I cant think of a way around this. without bubbling the error up and restarting the server. but that means if this was released into the wild someone could telnet into it and crash the server causing it to restart.. doesnt make sense.
<younder> Why would you have a unencrypted connection that you can telnet into in the first place?
<Kingsy> what difference does it make if the connection is encrypted or not? it'll be a public port
<Kingsy> like port 443, or whatever. if it enforces encryption that doesnt matter if you can crash it by sending a ^C haha
X-Scale has joined #commonlisp
dirtcastle has quit [Server closed connection]
<Kingsy> well, if anyone is around, I can describe my issue. I would really appreciate some help from someone :) spent quite a while on this over the past couple of days.
<jcowan> we're here
<jcowan> "Don't ask to ask, just ask"
dirtcastle has joined #commonlisp
<Kingsy> ah haha. just takes a bit to explain so wanted to know if someone might be intersted. but you are right. I'll describe anyway.
zetef has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
Gleefre has quit [Remote host closed the connection]
<Kingsy> so this is my code -> https://bpa.st/I2KA <- its quite simple. a TCP server with usocket. it works just fine and just echos back over the stream anything the user puts into it. BUT as soon as the user within telnet types ^C or control+C the stream crashes. which is why I have now chosen to throw an error then return out of the loop because at least now it gracefully exits. without this the program gets
<ixelp> View paste I2KA
Gleefre has joined #commonlisp
<Kingsy> stuck in the serve-client loop seemingly functioning just fine but is unable to write back into the stream. it recieves messages on the stream. echos them to stdout but it cant write the message back. so the stream seems dead client side.
<Kingsy> I was hoping to have a discussion around what is happening here and potentially get some ideas to make this TCP server generally more robust so its not possible for the "client" to crash it.
santiagopim has joined #commonlisp
<gilberth> Kingsy: FORCE-OUTPUT
thollief has quit [Remote host closed the connection]
<Kingsy> have in mind though that I am still kinda new to common lisp so happy to read docs but I don't want to over complicate the application / code. I want to make it super simple (as you can see)
<Kingsy> gilberth: ?
<gilberth> Are you using FORCE-OUTPUT on the stream after you have written to it?
<Kingsy> yeah seems to, there is a FORMAT and a TERPRI against the stream before the FORCE-OUTPUT
<Kingsy> I thought this was good practice to flush the stream before waiting to listen again
mgl_ has quit [Ping timeout: 256 seconds]
prokhor has joined #commonlisp
<younder> Yeah, The same occurs to me. It seems like C-c is still in the buffer. reuse-address means you read it again. It reads the same C-c and there you go
<gilberth> Yes, it is. So this must be something else.
<Kingsy> tell you what. let me remove the code throwing the errors so I can show you the output and it looping. its so so weird.
<gilberth> Wait a second, you still use telnet and type ^C?
certainty has joined #commonlisp
<Kingsy> gilberth: yea. I cant reproduce it with nc. if you use nc it just closes the connection to the stream and doesnt sen the char
<gilberth> I told you, don't do that. ^C with telnet is not what you believe it is. You're not even talking the TELNET protocol.
<Kingsy> gilberth: oh I know. but my rationale is this.
<gilberth> Still. What you believe telnet sends, when you want to transport an interrupt?
<Kingsy> gilberth: lets imagine this TCP server is released and being used on a server somewhere.. and that server is exposing this server on port 12345. whats to stop someone doing telnet some.ip 12345 ^C and crashing it?
<younder> There is a force output on the client side, but not on the server side.
<Kingsy> you want to write the server in such a way that it doesnt matter if omeone is not using telnet as they should no?
jmdaemon has quit [Ping timeout: 256 seconds]
mgl_ has joined #commonlisp
<Kingsy> gilberth: I geuss what I am saying is. I don't care what telnet is sending. I just want to either handle it. or error and move on. but certainly not crash
certainty has quit [Ping timeout: 256 seconds]
<gilberth> Kingsy: telnet sends IAC IP which is #xFF something. That's not UTF-8 to begin with. You'll have a problem with any non-UTF-8 input. So fix your UTF-8 decoder to use a replacement character instead of signalling an error. Which a proper UTF-8 decoder should do for this very reason to not crash a server.
<gilberth> Or use binary I/O.
<gilberth> Or have a HANDLER-CASE for whatever error is signalled.
<younder> Here's my theory there is no unwind-protect and socket-close is not called when C-c causes a exit.
<gilberth> There are two things to close: The listener socket and the stream. You close the socket only.
<Kingsy> yeah so this is what I am asking. I tried making it more generic than that. I was just catching a generic (error (e) .. ) but it still broke the stream
<Kingsy> yeah I think I am going to roll this back you are right. there is no need to back out and close.
<Kingsy> I want to be able to handle it
zetef has quit [Ping timeout: 246 seconds]
zetef has joined #commonlisp
<gilberth> Why close the listener? Close the stream instead.
X-Scale has quit [Ping timeout: 250 seconds]
<gilberth> Use (with-open-stream (stream (socket-stream (socket-accept ...))) (serve-client stream)).
<gilberth> WITH-OPEN-STREAM will ensure that stream is closed no matter how that body exits.
jmdaemon has joined #commonlisp
<Kingsy> ah ok that could be a good change.
pestctrl has quit [Remote host closed the connection]
danse-nr3 has quit [Ping timeout: 268 seconds]
<Kingsy> alright! this is looking much better! lol I need to figure out how this works now.
<Kingsy> gilberth: how did you know to use with-open-stream?
<Kingsy> sorry if thats a dumb question
<Kingsy> I thought the let and the when were doing the same thing.
larix1 has quit [Remote host closed the connection]
larix1 has joined #commonlisp
<gilberth> with-open-stream is (let ((stream ...)) (unwind-protect ... (close stream))
<Kingsy> thankyou. reading about the concept
<Kingsy> gilberth: I really appreciate you taking the time to look at my issue and suggest this.
rgherdt__ is now known as rgherdt
<gilberth> Could look like this: https://termbin.com/cq5l
* gilberth vanishes.
tyson2 has joined #commonlisp
anticrisis has quit [Read error: Connection reset by peer]
X-Scale has joined #commonlisp
anticrisis has joined #commonlisp
ahc has joined #commonlisp
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
certainty has joined #commonlisp
trocado has joined #commonlisp
certainty has quit [Ping timeout: 268 seconds]
<Kingsy> gilberth: very helpful and lots to think about thankyou
shka has quit [Ping timeout: 246 seconds]
habamax has joined #commonlisp
mgl_ has quit [Ping timeout: 260 seconds]
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
moon-child has quit [Quit: !]
moon-child has joined #commonlisp
larix has quit [Ping timeout: 256 seconds]
<mfiano> Oh boy, how did I get into this? I should have just wrote an ad-hoc solution 10 minutes ago.
larix1 has quit [Ping timeout: 268 seconds]
habamax has quit [Remote host closed the connection]
<mfiano> Please, how can I both left and right zero pad a negative integer with FORMAT. I would like to convert an integral GMT offset of -5 for example, to "-0500".
attila_lendvai has quit [Ping timeout: 256 seconds]
<moon-child> how do you determine the number of zeroes to the right? Isn't it always 2?
certainty has joined #commonlisp
<mfiano> Yes, I would assume so. I just am not sure how to combine both paddings. Depending on aesthetic or decimal output, I have this so far: ,(format nil "~4,,,'0a" -5) and ,(format nil "~4,,,'0@<~d~>" -5)
<ixelp> (format nil "~4,,,'0a" -5) => "-500", also (format nil "~4,,,'0@<~d~>" -5) => "-500"
<moon-child> I don't understand. Why not just put a literal 00 afterward?
<mfiano> that could work, for offsets that always fall on the hour. That isn't always the case.
<bike> well what are you giving it if not an integral number of hours
<bike> you just said it was an integral offset. minutes? doesn't seem like there's any problem if it's minutes.
<mfiano> I haven't decided yet :/ I got annoyed with this problem and clearly haven't been thinking ahead.
<moon-child> well, first figure out how you're going to decide how many zeroes to put afterwards
certainty has quit [Ping timeout: 256 seconds]
<mfiano> Thanks, had a phone call.
hineios25 has joined #commonlisp
hineios2 has quit [Ping timeout: 245 seconds]
hineios25 is now known as hineios2
ahc has quit [Quit: Client closed]
reb has joined #commonlisp
jmdaemon has quit [Ping timeout: 246 seconds]
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
rgherdt has quit [Quit: Leaving]
jmdaemon has joined #commonlisp
chomwitt has quit [Ping timeout: 268 seconds]
santiagopim has quit [Ping timeout: 268 seconds]
anticomputer has quit [Remote host closed the connection]
anticomputer has joined #commonlisp
makomo has quit [Ping timeout: 268 seconds]
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
certainty has joined #commonlisp
X-Scale has quit [Quit: Client closed]
xlymian has joined #commonlisp
certainty has quit [Ping timeout: 268 seconds]
X-Scale has joined #commonlisp
dino_tutter has quit [Ping timeout: 256 seconds]
<mfiano> Ok, so assuming I do treat the input as hours, how do I left-pad -5 as "-05" and not "0-5"?
* mfiano fails
X-Scale has quit [Quit: Client closed]
<mfiano> It seems this is not possible with ~d or ~f, and just always operates on the character input, unless I'm missing some operator/parameter.
<mfiano> s/operator/directive/
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
<Kingsy> mfiano: sorry just saw this. I am not sure what you are trying to do. but why are you talking about left padding? you just want to make a number negative you can do it with ~@D or ~D then subtract it from zero
zetef has quit [Ping timeout: 246 seconds]
<mfiano> Hm?
<Kingsy> hahaha I am super new to CL. so I am probably totally missing your point. :D
<mfiano> If you have the numbers 4 and 42, and you want the strings "004" and "042", format is what i reach for. When I have the numbers -4 and 42 and I want "-004" and not "00-4", it annoys me and I just write a one-off functionally.
<gilberth> mfiano: Indeed, you cannot do this with ~D. It's cheap and the padding is applied on the character level on the textual representation of that object.
<gilberth> So you're searching for something that doesn't exist. Is that behavior of ~D silly? Guess so.
bh34e5 has joined #commonlisp
<mfiano> It's not silly. It's just always not what I expect, and my old brain can never remember if I'm missing something, and I waste time using some cryptic DSL.
<mfiano> I like format, I just don't like it.
<Kingsy> um I don't see why it wouldnt work -> (format t "Padded with leading zeros and sign: ~@05D~%" -4)) => Padded with leading zeros and sign: -0004 <- or am I mad?