NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
NotThatRPG has joined #commonlisp
ec has joined #commonlisp
zacque has joined #commonlisp
trumae has quit [Ping timeout: 250 seconds]
Bike has quit [Quit: Connection closed]
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 276 seconds]
Bike has joined #commonlisp
jeffrey has quit [Quit: Client quit]
<mfiano>
I have (let ((i 0)) (alexandria:mappend (lambda (x) (prog1 (progn `(...)) (incf i))))) at macro-expansion time. Is there a more idiomatic way than (prog1 (progn ...)) to have a lambda return a list, but perform some side-effects afterwards?
<mfiano>
I feel very wrong for using prog1 above progn
<Alfr>
mfiano, if you ask me, I'd say that's quite idiomatic, as it's essentially saying that you want the k-th value, assuming the progn hold k forms.
<mfiano>
Yes that is the case. I just never thought to use prog1 over progn before for side-effecting after the kth value, but still returning the kth value. I guess it is just weird seeing it for the first time, and I questioned if a more idiomatic way existed.
<Alfr>
mfiano, only thing to note is that prog1 will eat up all but the first (if more) value from the progn.
Inline has joined #commonlisp
<mfiano>
You mean multiple return values? Yes that is expected. In this case it is a:mappend, or mapcar, I haven't decided what I need just yet as I'm still in macro-land.
<mfiano>
No mapping functions return multiple values, so that is satisfactory.
<semz>
maybe (progn ... (prog1 value-form effect-form)) is a little more readable
<semz>
since it emphasizes that most of the progn is executed for side-effects
<semz>
or rather that most of it is side-effects and just the return value is different
<mfiano>
I don't understand what you mean by "most", as the side-effect is just an incf, and the value-form is quite large.
ebrasca has quit [Remote host closed the connection]
<semz>
Then I don't understand what the progn is for.
pranavats has left #commonlisp [Error from remote client]
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 276 seconds]
semz_ has joined #commonlisp
semz is now known as Guest3202
semz_ is now known as semz
<beach>
Good morning everyone!
<semz>
good morning
Guest3202 has quit [Ping timeout: 240 seconds]
Bike has joined #commonlisp
Demosthenex has quit [Ping timeout: 260 seconds]
pranavats has joined #commonlisp
Demosthenex has joined #commonlisp
shka has joined #commonlisp
livoreno has joined #commonlisp
cmack has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
notzmv has joined #commonlisp
semz_ has joined #commonlisp
pollock has joined #commonlisp
hashfunc1ebd has joined #commonlisp
semz has quit [Ping timeout: 240 seconds]
trumae has quit [Ping timeout: 240 seconds]
semz_ is now known as semz
ldb has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)]
yauhsien has joined #commonlisp
slowButPresent has quit [Quit: leaving]
Bike has quit [Quit: Connection closed]
yauhsien has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
<mfiano>
SLIME question: Since special variables are (usually, implementation-dependent) thread-local, is there a way to make the bindings available to the SLIME compilation worker thread? This is the thread that invokes the compiler when you C-c C-c on a form. In my case I have a macro that references a special variable as part of its expansion (not at macro-expansion time when it would be unbound with
<mfiano>
(defvar *foo*)), and I would like the current binding on the REPL thread (where I invoke my program from) to be seen by the SLIME compilation thread (where recompilations occur).
yauhsien has quit [Ping timeout: 240 seconds]
admich1 has quit [Ping timeout: 250 seconds]
lisp123 has joined #commonlisp
<mfiano>
Oh ignore that. I am thinking about things wrong and my problem specification changed to void that question.
hashfunc1ebd has quit [Ping timeout: 250 seconds]
euandreh has quit [Ping timeout: 260 seconds]
lisp123 has quit [Ping timeout: 240 seconds]
euandreh has joined #commonlisp
admich1 has joined #commonlisp
<jackdaniel>
a standard way is to pass as a thread labda something like
x88x88x has quit [Remote host closed the connection]
admich1 has quit [Remote host closed the connection]
admich1 has joined #commonlisp
yauhsien has quit [Remote host closed the connection]
contrapunctus has joined #commonlisp
yauhsien has joined #commonlisp
yauhsien has quit [Ping timeout: 272 seconds]
Cymew has joined #commonlisp
admich1 has quit [Ping timeout: 272 seconds]
yauhsien has joined #commonlisp
admich1 has joined #commonlisp
vats has quit [Ping timeout: 256 seconds]
rotateq has joined #commonlisp
admich1 has quit [Read error: Connection reset by peer]
admich1 has joined #commonlisp
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 246 seconds]
seok has quit [Ping timeout: 240 seconds]
OlCe has quit [Ping timeout: 256 seconds]
admich1 has quit [Ping timeout: 276 seconds]
ttree has quit [Ping timeout: 248 seconds]
yauhsien has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
admich1 has joined #commonlisp
yauhsien has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
treflip has joined #commonlisp
treflip has quit [Remote host closed the connection]
yauhsien has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
xaotuk has joined #commonlisp
Sankalp has quit [Ping timeout: 256 seconds]
admich1 has quit [Ping timeout: 276 seconds]
admich1 has joined #commonlisp
Sankalp has joined #commonlisp
yauhsien has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
aeth has quit [Ping timeout: 276 seconds]
admich1 has quit [Read error: Connection reset by peer]
aeth has joined #commonlisp
xaotuk has quit [Ping timeout: 240 seconds]
pve has joined #commonlisp
zacque has quit [Quit: Goodbye :D]
zeroc00l0 has joined #commonlisp
yauhsien_ has joined #commonlisp
yauhsien has quit [Ping timeout: 256 seconds]
<pve>
Hello! I'm reading about the progn method combination. It seems to me that the same effect can be achieved using :before methods. Is that correct?
<Shinmera>
if the combination is most-specific-first, yes.
<pve>
Shinmera: ok, thanks
<pve>
most-specific-last would correspond to :after methods then?
<Shinmera>
sure.
<Shinmera>
in any case the point of the method combination is to communicate intent.
<pve>
I see, that makes sense
pjb has joined #commonlisp
igemnace has quit [Remote host closed the connection]
igemnace has joined #commonlisp
xaotuk has joined #commonlisp
yauhsien_ has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
<rotateq>
Hm but wasn't a difference that PROGN method combination offers combining if just primary methods are defined?
<jackdaniel>
the return values also depend on the combination
<rotateq>
ah okay makes sense
Madsy has joined #commonlisp
yauhsien has joined #commonlisp
lisp123 has quit [Ping timeout: 240 seconds]
<jackdaniel>
I have not very strong opinion that methid combinations and most notably auxiliary methids like after, make learning the intention by reading the code harder
<jackdaniel>
putting aside the ootimization concerns
<jackdaniel>
opt*
<rotateq>
I like them for better modularization options and adjusting.
yauhsien has quit [Ping timeout: 240 seconds]
<rotateq>
pve: The cool thing is, in all of the other pre-defined method combinations you can have `:around` too.
<pve>
rotateq: you mean progn with :around?
<pve>
for example
<pve>
I'm not sure my head can take that much this early in the day
<rotateq>
No additionally.
<rotateq>
so doing (defmethod foo progn ...) and for the same dispatch specialization a (defmethod foo :around ...) but don't forget then the (call-next-method). :)
Inline has joined #commonlisp
<pve>
Ok, I see. I'm having a hard time coming up with an example where it would make actual sense to use all that, but maybe it's one of those "you'll see it when you need it" kind of things.
<rotateq>
Yes I know that.
<rotateq>
pjb had a file with good usescases some months ago
<pve>
yeah, I was about to ask about actual usage in the wild
<rotateq>
Iirc the file was about things with space shuttles.
<rotateq>
Like using + for "how much costs do all parts of this component make?".
<pve>
hmm that sounds interesting
<rotateq>
Or when I did some simple virtual supermarket checkout program, the articles of same class were counted and then a new class for the purchase was done temporarily (naming it with a gensym) that inherit from all supply classes.
zeroc00l0 has quit [Quit: Client closed]
<pve>
that also sounds like an "interesting" approach :)
<jackdaniel>
oop is the best thing since sliced bread, but not all people think that sliced bread is good for software engineering
<beach>
pve: If you think of a situation of a "supplier" and a "client" where the supplier is typically a library that defines some classes, and the client can define subclasses of those classes, then :AROUND method are often used by the supplier to intercept any call to the generic function before the first client-supplied method is invoked.
<beach>
An example would be caching; the supplier may have stored the value to be returned, so that the full computation need not be performed.
<rotateq>
pve: Each checkout system would then have its own REPL image running and in between queries the database or gets updates in regarding discounts or something.
<pve>
beach: ok, that I get
<rotateq>
jackdaniel: That seems familiar from the McCLIM main page. ;)
yauhsien has joined #commonlisp
<pve>
being an avid baker, bread is one of the most important precursors to software over here :)
treflip has joined #commonlisp
<mfiano>
I actually prefer my bread un-sliced, thank you. It lasts longer and tastes better.
<mfiano>
Or a more related note, are there any decent books besides AMOP and OOP in CL that use CLOS as a pedagogical tool? It doesn't necessarily need to be about the language. It could be something more to the likes of Sussman's SDfF.
<mfiano>
s/Or/On/
jmdaemon has quit [Ping timeout: 246 seconds]
attila_lendvai has joined #commonlisp
vats has joined #commonlisp
cosimone has joined #commonlisp
xaotuk has quit [Ping timeout: 240 seconds]
orestarod has joined #commonlisp
frgo has joined #commonlisp
dnaeon has joined #commonlisp
dnaeon has quit [Changing host]
dnaeon has joined #commonlisp
frgo has quit [Ping timeout: 276 seconds]
dnaeon has quit [Client Quit]
kevingal has joined #commonlisp
lisp123 has joined #commonlisp
yauhsien has quit [Remote host closed the connection]
lisp123 has quit [Quit: Leaving...]
pranavats has left #commonlisp [Error from remote client]
yauhsien has joined #commonlisp
<mfiano>
Is this destructuring behavior of LOOP conforming, in that is produces NILs if the list isn't long enough, unlike DESTRUCTURING-BIND? (loop :for (a b) :in '((1 2) (3)) :collect b) ;=> (2 NIL)
<semz>
> If there are more variables in the variable list than there are values in the values list, the remaining variables are given a value of nil. If there are more values than variables listed, the extra values are discarded.
<mfiano>
Perfect. I just wanted to make sure before I rely on this, as it's what I need. I use D-B often enough that I can't remember all the differences of LOOP's destructuring.
yauhsien has quit [Ping timeout: 276 seconds]
xaotuk has quit [Ping timeout: 272 seconds]
xaotuk has joined #commonlisp
pranavats has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 246 seconds]
Lord_of_Life has joined #commonlisp
leo_song has quit [Ping timeout: 240 seconds]
Oddity has quit [Ping timeout: 256 seconds]
frgo has joined #commonlisp
tyson2 has joined #commonlisp
jmes has joined #commonlisp
Dynom has joined #commonlisp
jmes has quit [Remote host closed the connection]
frgo has quit [Ping timeout: 256 seconds]
zeroc00l0 has joined #commonlisp
admich1 has joined #commonlisp
prov has joined #commonlisp
notzmv has quit [Ping timeout: 260 seconds]
xaotuk has quit [Ping timeout: 246 seconds]
xaotuk has joined #commonlisp
pillton has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)]
yewscion has joined #commonlisp
leo_song has joined #commonlisp
random-nick has joined #commonlisp
kevingal has quit [Ping timeout: 276 seconds]
hhdave_ has joined #commonlisp
hhdave has quit [Ping timeout: 272 seconds]
hhdave_ is now known as hhdave
livoreno has quit [Ping timeout: 240 seconds]
pollock has quit [Remote host closed the connection]
rgherdt has joined #commonlisp
yagamisato has quit [Ping timeout: 240 seconds]
yagamisato has joined #commonlisp
yagamisato has joined #commonlisp
yagamisato has quit [Changing host]
admich1 has quit [Read error: Connection reset by peer]
admich1 has joined #commonlisp
Josh_2 has joined #commonlisp
<Josh_2>
Good morning
<Josh_2>
With parenscript how can I use the await/async keywords for functions?
<Josh_2>
Guess I can just use promises directly
admich1 has quit [Read error: Connection reset by peer]
slowButPresent has joined #commonlisp
admich1 has joined #commonlisp
cross has joined #commonlisp
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yauhsien has joined #commonlisp
kevingal has joined #commonlisp
yauhsien has quit [Ping timeout: 246 seconds]
<Josh_2>
Would be nice to have async/await support, idk if I'm just missing something
Bike has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
pjb has quit [Ping timeout: 240 seconds]
cakir has joined #commonlisp
zeroc00l0 has quit [Ping timeout: 252 seconds]
admich1 has quit [Read error: Connection reset by peer]
admich1 has joined #commonlisp
admich1 has quit [Read error: Connection reset by peer]
admich1 has joined #commonlisp
admich1 has quit [Read error: Connection reset by peer]
tyson2 has quit [Remote host closed the connection]
cage has joined #commonlisp
Inline has quit [Quit: Leaving]
Inline has joined #commonlisp
morganw has joined #commonlisp
admich1 has quit [Ping timeout: 272 seconds]
admich1 has joined #commonlisp
vats has joined #commonlisp
admich1 has quit [Ping timeout: 250 seconds]
admich1 has joined #commonlisp
White_Flame has quit [Quit: No Ping reply in 180 seconds.]
White_Flame has joined #commonlisp
admich1 has quit [Read error: Connection reset by peer]
yottabyte has joined #commonlisp
admich1 has joined #commonlisp
rogersm has joined #commonlisp
ttree has joined #commonlisp
Oladon has joined #commonlisp
dlowe has joined #commonlisp
aeth has quit [Ping timeout: 248 seconds]
tyson2 has joined #commonlisp
aeth has joined #commonlisp
dilated_dinosaur has joined #commonlisp
cosimone has quit [Read error: Connection reset by peer]
treflip has quit [Remote host closed the connection]
ec has joined #commonlisp
ec has quit [Client Quit]
ec has joined #commonlisp
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
ksp has joined #commonlisp
<ksp>
i have an issue with usocket where it is throwing a usocket:connection-refused-error
<ksp>
here is the example code: (let ((socket (usocket:socket-connect "64.13.139.230" 83 :element-type 'character))) (unwind-protect (progn (usocket:wait-for-input socket) (format t "~A~%" (read-line (usocket:socket-stream socket)))) (usocket:socket-close socket)))
ec has quit [Client Quit]
ec has joined #commonlisp
<ksp>
it just connects to telehack.com and gets the motd
cosimone has joined #commonlisp
poselyqualityles has joined #commonlisp
kpoeck has joined #commonlisp
ksp has quit [Remote host closed the connection]
hhdave has quit [Remote host closed the connection]
Inline has quit [Quit: Leaving]
treflip has joined #commonlisp
poselyqualityles has quit [Ping timeout: 276 seconds]
matt` has joined #commonlisp
poselyqualityles has joined #commonlisp
karlosz has joined #commonlisp
attila_lendvai has joined #commonlisp
simendsjo has joined #commonlisp
simendsjo has quit [Remote host closed the connection]
treflip has quit [Quit: goodnight]
tyson2 has quit [Remote host closed the connection]
jmdaemon has joined #commonlisp
waleee has joined #commonlisp
karlosz has quit [Ping timeout: 240 seconds]
matt` has quit [Remote host closed the connection]
Madsy has joined #commonlisp
Oddity has joined #commonlisp
molson has quit [Remote host closed the connection]
molson has joined #commonlisp
Oladon has quit [Quit: Leaving.]
wmblathers has joined #commonlisp
admich1 has quit [Quit: Quit]
cage has quit [Quit: rcirc on GNU Emacs 27.1]
kpoeck has quit [Quit: Client closed]
notzmv has joined #commonlisp
yewscion has quit [Quit: Connection closed]
tyson2 has joined #commonlisp
dlowe has quit [Remote host closed the connection]
poselyqualityles has quit [Ping timeout: 272 seconds]
notzmv has quit [Ping timeout: 240 seconds]
yewscion has joined #commonlisp
Dynom has quit [Quit: WeeChat 3.5]
pjb has quit [Ping timeout: 250 seconds]
poselyqualityles has joined #commonlisp
poselyqualityles has quit [Ping timeout: 260 seconds]
poselyqualityles has joined #commonlisp
Inline has joined #commonlisp
rgherdt has quit [Remote host closed the connection]
Guest74 has quit [Quit: Ping timeout (120 seconds)]
zeroc00l0 has joined #commonlisp
aeth has quit [Ping timeout: 272 seconds]
aeth has joined #commonlisp
aartaka has quit [Ping timeout: 272 seconds]
pve has quit [Quit: leaving]
Guest74 has joined #commonlisp
attila_lendvai has quit [Ping timeout: 250 seconds]
rgherdt has joined #commonlisp
abrantesasf has joined #commonlisp
zeroc00l0 has quit [Quit: Client closed]
santiagopim has quit [Remote host closed the connection]
<mfiano>
Any FORMAT experts around?
<lieven>
just ask your question. maybe someone will respond.
<lieven>
format is cute but when stuff gets complicated often writing it more explicitly is better
shka has quit [Ping timeout: 276 seconds]
abrantesasf has joined #commonlisp
<rotateq>
mfiano: Or could maybe the ~? directive be helpful to pass another control-string?
<mfiano>
I have this: (format nil "~[~va~;~v@a~]" 0 20 "hello world")
<rotateq>
ah okay
<mfiano>
Which left pads the string with a 0 argument, or right pads it with a 1 argument
<mfiano>
However, I also want to truncate the string from the left or right if "hello world" is larger than 20
<mfiano>
(format nil "~[~va~;~v@a~]" 0 10 "hello world") should give "hello worl", and (format nil "~[~va~;~v@a~]" 1 10 "hello world") should give "ello world", is the behavior I'm after.
<mfiano>
But continuing to pad like it is if the string is shorter than 10
aeth has quit [Ping timeout: 276 seconds]
orestarod has quit [Ping timeout: 240 seconds]
aeth has joined #commonlisp
yauhsien has joined #commonlisp
yauhsien has quit [Ping timeout: 276 seconds]
Inline has quit [Remote host closed the connection]
poselyqualityles has quit [Ping timeout: 240 seconds]
Inline has joined #commonlisp
poselyqualityles has joined #commonlisp
igemnace has joined #commonlisp
Noisytoot has quit [Ping timeout: 240 seconds]
Noisytoot has joined #commonlisp
<dre>
hey all, is there a way that I could somehow "patch" all functions that expect to read from stdin? like (read-line)
<dre>
I want to make it so when I run a program, each time it expects input from stdin, it prints out ">" as a prompt or something.. but I don't wanto go and change each (read-line) invocation in the code
siabard has joined #commonlisp
<dre>
I want to do it on the running system so that future (read-line) calls does the prompt..
morganw has quit [Remote host closed the connection]
<semz>
You could bind *standard-input* to a stream that does what you want
<dre>
That sounds almost like what I want; thanks, I'm a little noob so bare with me.
<rotateq>
if you have this in your own package, you could shadow CL:READ-LINE and replace with a call like (progn (format *standard-output* "> ") (cl:read-line))
<dre>
the particular issue I'm facing is that I'm trying to find a way to "signal" that we're expecting standard input. is that possible if I make my own std-in steam?
<rotateq>
ah signaling is good :)
<dre>
perhaps if i bind stdin to my own stream, then I could hook when the stream opens each time? or am I not thinking correctly... ( sorry, newbiness, like i said)
<dre>
rotateq, ye that's what I was thinkign, but I don't want to specify for read-line, but rather, "all stdin calls"
<rotateq>
I'm not sure with this right now.
<rotateq>
ah okay :)
<dre>
I wonder if there's a lower level (read-byte) that all the read-* calls use, then I could just shadow that to (progn (foo) (cl:read-byte)) right?
<rotateq>
what you can do too is defining (let ((*standard-input* some-other-stream-name)) ...) to shadow it locally
abrantesasf has quit [Remote host closed the connection]
<dre>
but what does that give me? I have `some-other-stream` which I can feed information into, which I get, but is there some way I could "hook" or something for when it's needed?
<rotateq>
no READ-BYTE is for well, reading a byte. then we have READ-CHAR, READ-LINE (that gives back a string) and READ itself, that tries to give meaning to typed in strings
<semz>
dre: Look into trivial-gray-streams. It lets you define how your own type of input-stream handles reading
<semz>
it's pretty much made for things like these
<semz>
The Slime REPL works like this too iirc, it's made of stream classes that redirect everything to Emacs
<rotateq>
dre: you can define own streams with a symbol-name like (with-open-file (s #p"/file/path) ...)
<rotateq>
ah yes good idea
<dre>
semz, ye, thanks, and that's sorta *sorta*~ what I'm trying to emulate. but I don't think slime takes from stdin right? if you (read-line) in slime, does that expect input in swank or in emacs mini-buffer ?
<dre>
( sorry I don't use emacs yet.)
<dre>
I'm still making CL work on neovim goddommot xD
<semz>
it expects input in the REPL buffer
<dre>
ah ye, I don't want that, i want to signal the input back to nvim, so I can have a prompt, and get the input from that. (i realise that REPL is best but just work with me here)
<semz>
If you have some way to communicate with nvim nothing stops you from making your stream class do that
<dre>
I have swank connected and working, and i can send and receive messages, and I think all I'd need to do is just "when swank is expecting input ( signaled from my foo call above) then prompt on nvim, get that data, send to *standard-input*, contine on)
<dre>
yeah cheers, trivial gray streams looks like the way to go