azimut has quit [Remote host closed the connection]
ec has quit [Remote host closed the connection]
azimut has joined #commonlisp
Posterdati has joined #commonlisp
ec has joined #commonlisp
<McParen>
hello, is there a commonly used macro that abbreviates (with-accessors ((a a) (b b)) obj) to (with-accessors (a b) obj), to be in line with with-slots?
trev has joined #commonlisp
leeb has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
kpoeck has quit [Quit: kpoeck]
<Josh_2>
You could make it very easily
<McParen>
I know, I wanted to find out first if it is already in use in some known library.
x88x88x has joined #commonlisp
treflip has joined #commonlisp
kpoeck has joined #commonlisp
dra_ has quit [Quit: Leaving]
<Guest74>
It's funny because we have multiple different types of each library and one of the most common things heard when someone asks if something exists is 'you can write it'.
xaltsc has quit [Remote host closed the connection]
<yitzi>
Because rolling your own simple macros is the lisp style, versus including a bloated utility library.
<White_Flame>
that's how old lisp programs are still runnable even today, because they're fully self-contained
<White_Flame>
QL is extremely handy, but it does bring with it that environmental dependency for being able to run things in the future
<Guest74>
It starts with a macro, and next thing you know you're writing a testing library that uses your macros instead of some other library that imports a bloated utility library.
<lisp123>
yitzi: +1
<Josh_2>
Guest74: well if doing that wasn't so easy...
<lisp123>
Guest74: Starts with a macro, then testing / json / database libraries, then GUIs, Lisp Implementations and Finally OSes
MajorBiscuit has joined #commonlisp
<Guest74>
I never really felt the need to implement lisp.
<lisp123>
If you work with other languages, you start dreaming of implementing lisp within them
<lisp123>
For me at least. Its on my list to implement a mini cl/elisp in JS now
kpoeck has quit [Ping timeout: 252 seconds]
<rotateq>
lisp123: did you really say elisp? :D
<Josh_2>
well might take a while to implement CL in anything
<Guest74>
I wish somebody has that dream about making lisp available from Unity/Unreal.
<Guest74>
and does something about it.
<lisp123>
I want to adopt the emacs API for text editors
<Guest74>
what about it apeals to you?
<lisp123>
Josh_2: more like a lisp 2 subset - no condition system / CLOS but yes to macros
leeb has quit [Ping timeout: 260 seconds]
<lisp123>
Guest74: I'm used to it mainly + if I'm done with my online editor program, a few people from the Emacs world may try and write packages for it
<lisp123>
So want to stay consistent
<Josh_2>
But CLOS is amazing
<Josh_2>
:sob:
<Josh_2>
lisp123: why not help with making climacs 2?
<rotateq>
Josh_2: yes it's a mammot task
<rotateq>
Guest74: I thought on starting to write a binding for Godot, but it's a C++ monolith too and I don't have a clue on how the shared libs of it work and all.
<Josh_2>
Hope they have C bindings and use something like CLAW?
<rotateq>
Josh_2: funny is when "I don't use CLOS cause it's too powerful."
<lisp123>
Josh_2: No need, this is mostly at a lower level, so packages like climacs may be able to plug into it
<lisp123>
"Second Climacs is independent of any particular library for making graphic user interfaces, allowing it to be configured with different such libraries. "
waleee has joined #commonlisp
<beach>
McParen: That situation would be very unusual. Typically, the second symbol in each group would have a package prefix from a different package.
kpoeck has joined #commonlisp
mrcom has quit [Quit: Leaving]
lisp123 has quit [Quit: Leaving...]
<McParen>
beach: In the case where the accessors are all in the same package, because they are accessing one and the same object, it can be rather verbose. Ideally, you would have the option to choose between (variable accessor) or just accessor, which is how it is done in with-slots. also it would be consistent with with-slots.
<McParen>
so I guess there is no such commonly used macro, and I can roll my own..
treflip has quit [Remote host closed the connection]
Alfr has quit [Quit: Leaving]
MajorBiscuit has quit [Quit: WeeChat 3.4]
MajorBiscuit has joined #commonlisp
yauhsien has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
yauhsien has quit [Ping timeout: 246 seconds]
Guest74 has quit [Quit: Connection closed]
fitzsim has quit [Remote host closed the connection]
MajorBiscuit has quit [Ping timeout: 260 seconds]
irc_user has joined #commonlisp
mrcom has joined #commonlisp
Josh_2 has quit [Remote host closed the connection]
Josh_2 has joined #commonlisp
anticomputer has quit [Remote host closed the connection]
anticomputer has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
<yitzi>
McParen: In addition to beach's comment, with-accessors lets one deal with accessors that have the class name as prefix. This way you have have more terse variable names. https://plaster.tymoon.eu/view/3164
<yitzi>
s/have have/can have/
Bike has joined #commonlisp
<McParen>
yitzi: I thought that was the most common case, at least that is what I read from the clhs entry.
<McParen>
Nilby: thanks, something like that is what I thought of. Is this a snippet from some common library?
<beach>
McParen: Well, that seems to have been common when the standard was written, and also in many other systems like CLIM. But it seems that this convention was used because packages were underutilized.
borodust has quit [Ping timeout: 240 seconds]
<Nilby>
McParen: It's a snippet from a very uncommon library of which I'm the only user. But you can put it in any library you want as it's no copyright/public domain.
<Nilby>
McParen: If you use emacs, you can do something like this https://plaster.tymoon.eu/view/3165#3165 (with yasnippet or something) to auto-fill class prefixed slot names.
borodust has joined #commonlisp
waleee has quit [Quit: WeeChat 3.5]
MajorBiscuit has joined #commonlisp
<McParen>
Nilby: thanks for the hintÃ.
<Nilby>
You're welcome. Typing slot/accessor names can be boring so I try to avoid it.
waleee has joined #commonlisp
not-n1to has joined #commonlisp
kaskal has joined #commonlisp
n1to__ has joined #commonlisp
n1to has quit [Ping timeout: 276 seconds]
n1to__ has quit [Remote host closed the connection]
n1to has joined #commonlisp
frgo has joined #commonlisp
not-n1to has quit [Ping timeout: 256 seconds]
MajorBiscuit has quit [Ping timeout: 246 seconds]
MajorBiscuit has joined #commonlisp
<mfiano>
Happy weekend, everyone! Any interesting CL projects being worked on?
kpoeck has quit [Quit: kpoeck]
Bike has quit [Quit: Connection closed]
tyson2 has joined #commonlisp
Guest52 has joined #commonlisp
<beach>
mfiano: Thanks! I am trying to figure out how to configure Clouseau to inspect ersatz objects during SICL bootstrapping. I did something like that in the past, but it was fragile, because the SICL printer wasn't stable or complete. I hope this time it will be better.
<mfiano>
Oh, nice. Good luck this time.
<beach>
Thanks!
<beach>
It is a good opportunity to learn more about Clouseau configuration and internals.
<Guest52>
Is there a ubiquitous way to shadow a CLOS object's slot? Something like (slot-let (((age person) 50)) (do-something person))
<mfiano>
I am working on a ZFS filesystem abstraction for distributing filesystem snapshots to multiple hosts with rentention policies.
<mfiano>
Guest52: It is unclear what you mean by shadow a CLOS object's slot.
<mfiano>
Can you elaborate a bit further?
<Guest52>
Sure, I mean to change it's value temporarily. Just like a let binding can shadow global variables for it's scope. In the above example the age of person might be 25 but for the scope of slot-let it is changed to 50
<mfiano>
Guest52: Slots are implementation details. You probably mean one of a slots "accessors".
<beach>
Guest52: You can wrap something like that in a macro.
<Guest52>
s/it's/its/g
Everything has joined #commonlisp
<Guest52>
beach: Yeah I was thinking about creating a macro but I wanted to ask if this was something that is already commonly used and therefore implemented
MajorBiscuit has quit [Ping timeout: 246 seconds]
<mfiano>
(with-slots (age) person (let ((old-age age)) (progn do-stuff) (setf age old-age))) or something
<mfiano>
You'll likely want to u-w-p the setf though
<mfiano>
or the progn, with the setf as a cleanup
<Guest52>
mfiano: What is u-w-p?
<mfiano>
Keep in mind though, that it's usually a code smell to work with slot values rather than accessors. This bypasses any protocols put in place, which may prevent your users from extending your program.
<mfiano>
unwind-protect
<Guest52>
ah ok
<mfiano>
So instead I would use with-accessors
<Guest52>
mfiano: okay, I'll look into that. Thanks!
<mfiano>
Anytime
MajorBiscuit has joined #commonlisp
yauhsien has joined #commonlisp
yauhsien has quit [Ping timeout: 246 seconds]
<mfiano>
What are my options for something more functional instead of w-o-t-s? I am using uiop:run-program, which takes a string or stream to write the output and error output to, but w-o-t-s returns the string which is not what I want.
<jackdaniel>
flexi-streams in-memory stream?
<mfiano>
I'd like to implement a w-o-t-s variant for side-effects only. It should return the last value in the body, rather than the string
<jackdaniel>
how about (make-broadcast-stream #|intentionally empty|#) ;?
<mfiano>
I'm not familiar with either of those, but I would infact like a string, not a stream
<jackdaniel>
I think that I don't understand your problem
<mfiano>
I would like to do something like (my-with-output-to-string (s) (uiop:run-program "foo" :error-output s)) and have it return the value of uiop:run-program, not the value of my-with-output-to-string
mariari has quit [Read error: Connection reset by peer]
mariari has joined #commonlisp
<jackdaniel>
and what about the content of s?
<mfiano>
That gets handled to uiop like above
<mfiano>
handed*
<jackdaniel>
yes, but why? do you need to allocate a string if you ignore it afterwards?
<jackdaniel>
(uiop:run-program "ls" :error-output (make-broadcast-stream)) ;<- no string attached
<jackdaniel>
apparently uiop before signaling error gets rid of the handler, because the process is finished
<jackdaniel>
s/handler/handle/
<mfiano>
What would you recommend instead of uiop. I've become rather fond of ruricolist/cmd, a wrapper over uiop, but I wouldn't mind making something similar for an alternative if one exists.
<jackdaniel>
run-program in sbcl, ecl and ccl all have almost identical interface
<mfiano>
I'd rather not write a portability library.
<jackdaniel>
I'd make a dumb portability layer (perhaps with some parameter sanitizer)
<mfiano>
I'm looking for something at least semi-portable.
<jackdaniel>
then (import #+sbcl sb-ext #+ecl ext #+ccl ccl #:run-program) will get you there
<jackdaniel>
as I said, interfaces are almost identical
<mfiano>
I see. I might explore that then. Thanks for your help.
<jackdaniel>
(comically so)
<jackdaniel>
sure
<mfiano>
What does uiop do aside mess things up then? :)
<jackdaniel>
I will spare you some sour commentary from myself; I'm sure it does plenty - it has a very long docstring after all
<jackdaniel>
more seriously though it tries to make things behave the same and unify the /almost/ identical interface
<mfiano>
I very strongly dislike uiop's code conventions, but I didn't know of a portable way.
<mfiano>
SO any sourness would likely be shared.
<jackdaniel>
because indeed implementations differ in some non-obvious ways - i.e with handling an asynchronous processes (and passing data to a stream without a file descriptor)
<mfiano>
Out of curiosity I tried handler-bind and the process is still null
<jackdaniel>
because the process has already exited, I guess uiop does: (run-program) (when error (cleanup) (signal)))
<mfiano>
What a pile of garbage
<mfiano>
I'm not sure what good exposing process-info accessors is then
<jackdaniel>
there is launch-program
<mfiano>
Ah async. Yeah I guess
<jackdaniel>
that basiclly re-implements (run-program ... :wait nil)
morganw has joined #commonlisp
<mfiano>
I think I'm just going to not worry about reporting the external program's stdout. It would make log files massive and hard to read anyway. Most programs think it's okay to output pages of help text after a single line error message, both on stdout.
<mfiano>
It seems even `ssh -V` (print version and exit) writes to stderr for some reason.
<mfiano>
Sometimes I hate Unix is the absense of conventions.
<mfiano>
s/is/and/
<ck_>
X Windows, Apply Directly to the Forehead
<jackdaniel>
because common lisp is a heaven of well estabilished consistent conventions across codebases ;p
<rotateq>
always :D
<mfiano>
haha
tyson2 has quit [Remote host closed the connection]
ahlk has joined #commonlisp
kpoeck has joined #commonlisp
MajorBiscuit has joined #commonlisp
<ck_>
Common Lisp enjoys many internally consistent, happily coworking communities of size one
<jackdaniel>
lies; I'm ow debugging my code from around a few months back
<jackdaniel>
s/ow/now/
<jackdaniel>
consistency my ass ; if not for a git blame I'd say a few words about the code author
<ck_>
I did not include 'perfectly coded' or 'working' in the list for a reason :)
Alfr has joined #commonlisp
MajorBiscuit has quit [Ping timeout: 244 seconds]
asarch has joined #commonlisp
aeth has quit [Ping timeout: 272 seconds]
pranavats has joined #commonlisp
aeth has joined #commonlisp
<mfiano>
Random thought: A unix pipe is like the cdr of a cons cell. Imagine how much more useful pipelines would be with a graph structure instead of a linked list.
<jackdaniel>
and how much more consistent programs would be written? ,)
<jackdaniel>
I think that I've read that multics had a stream interface between programs, so you could use a broadcast stream instead of a dumb pipe
<mfiano>
Nice
<rotateq>
"Just perfectly balanced, as all things should be."
asarch has quit [Quit: Leaving]
<sm2n>
How is a unix pipe like cdr? I'm not really following
<jackdaniel>
I think that the point was that programs are ordered in a "linked list"
akoana has joined #commonlisp
<jackdaniel>
indeed, with cons you may implement more structures
<mfiano>
I think the point was it enforces a dependency chain, so program (nth n foo) has to change of program (nth <n foo) changes
Bike has joined #commonlisp
<mfiano>
It's sort of imposes the opposite of modularity in the way it uses the cdrs to only allow a linked list.
<mfiano>
Anyway, I'm probably over thinking it. Back to code
pranavats has left #commonlisp [Error from remote client]
treflip has joined #commonlisp
kpoeck has quit [Quit: Client closed]
ehammarstrom_ has joined #commonlisp
ehammarstrom has quit [Ping timeout: 248 seconds]
tyson2 has joined #commonlisp
ehammarstrom has joined #commonlisp
ehammarstrom_ has quit [Ping timeout: 260 seconds]
treflip has quit [Remote host closed the connection]
kiki_lamb has joined #commonlisp
aeth has quit [Ping timeout: 240 seconds]
kiki_lamb has quit [Client Quit]
aeth has joined #commonlisp
irc_user has quit [Quit: Connection closed for inactivity]
yauhsien has joined #commonlisp
yauhsien has quit [Ping timeout: 246 seconds]
causal has joined #commonlisp
X-Scale` has joined #commonlisp
X-Scale has quit [Ping timeout: 240 seconds]
Oddity has joined #commonlisp
X-Scale` is now known as X-Scale
mfiano_ has joined #commonlisp
mfiano has quit [Ping timeout: 246 seconds]
mfiano_ is now known as mfiano
Josh_2 has quit [Remote host closed the connection]
Josh_2 has joined #commonlisp
kpoeck has joined #commonlisp
Everything has left #commonlisp [#commonlisp]
Josh_2 has quit [Remote host closed the connection]
Josh_2 has joined #commonlisp
pfd has joined #commonlisp
MajorBiscuit has joined #commonlisp
MajorBiscuit has quit [Ping timeout: 244 seconds]
trev has quit [Quit: trev]
ahlk has quit [Remote host closed the connection]
McParen has left #commonlisp [#commonlisp]
karlosz has joined #commonlisp
Bike_ has joined #commonlisp
Bike has quit [Quit: Connection closed]
Bike_ is now known as Bike
rogersm has joined #commonlisp
jmiven has joined #commonlisp
Dynom has quit [Quit: WeeChat 3.5]
rogersm has quit [Quit: Leaving...]
matt` has joined #commonlisp
ahlk has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 27.1]
matt` has quit [Remote host closed the connection]
skyl4rk` is now known as skyl4rk
matt` has joined #commonlisp
Josh_2 has quit [Remote host closed the connection]
Josh_2 has joined #commonlisp
matt` has quit [Remote host closed the connection]
kpoeck has quit [Quit: Client closed]
karlosz has quit [Ping timeout: 240 seconds]
aeth has quit [Ping timeout: 246 seconds]
aeth has joined #commonlisp
aun has joined #commonlisp
<aun>
Is there a proper detailed text somewhere where all the 22 classic "patterns" of programming are taken and it's shown how can they be either implemented or avoided in common lisp?
<Bike>
what are the 22 classic patterns?
Sankalp has quit [Ping timeout: 276 seconds]
<aun>
Design patterns
<aun>
like you know, singleton, observer, decorator etc
<Bike>
i've never heard of any canonical classic list. if you mean these https://refactoring.guru/design-patterns/catalog a lot of them are broader design things that you couldn't really "implement" in themselves. like, an adapter is just a translation between two interfaces
<aun>
oh yeah this site is nice
<aun>
I would love if they had examples in CL as well
<aun>
it's just that there's a lot of trash talk about how in CL you do not need design patterns
<rotateq>
And CLOS isn't a class-centered approach, nor does it have/need this "private/public" behavior.
<aun>
yea I saw that already and even more. unfortunately this is just a presentation and so it doesn't contain a lot of info
<rotateq>
Ah okay.
<rotateq>
Someone in another channel called those design pattern stuff from "our" view point satiric. :)
<aun>
yeah this is exactly the kind of trash talk I was talking about
<rotateq>
It's not really trash talk as this person is really experienced like others here.
<aun>
it doesn't matter at all
<rotateq>
When you come to the conclusion that you just don't need it nor would it make sense.
<aun>
as long as there's no clear explanation as to why these patterns are redundant in CL
<rotateq>
Yes okay.
<rotateq>
Then make your own experiences.
VGaranja has quit [Remote host closed the connection]
<aun>
yeah I d rather just saw somebody else's. I don't have time to rediscover everything in this world. This is why I came here to ask
<aun>
I was hoping on of those "very experienced people" would enlighten me
anticomputer has quit [Remote host closed the connection]
anticomputer has joined #commonlisp
gaqwas has joined #commonlisp
<Bike>
seems like this presentation covers a lot of it, for example saying that the "factory pattern" isn't needed per se because "types [...] serve as factories". which means the pattern is still there, but the programmer doesn't need to implement it
beach`` has joined #commonlisp
<Bike>
it's presentation slides rather than a document in itself, but sometimes that's all there is
beach has quit [Ping timeout: 248 seconds]
<aun>
Bike yeah the factory pattern is like, one exception (to certain extent) I found so far
<aun>
Sometimes multiple dispatch makes it a bit easier as well.
<aun>
But afaic most of the stuff still needs to be done
<rotateq>
It's the bread and butter.
<rotateq>
Do you know about method combinations?
<aun>
Yes
<rotateq>
Good. Those cover a lot too.
<aun>
Can you specify exactly the pattern they cover?
<aun>
I can. And despite that you'd still need to write them so it's more of an implementation detail of a pattern and not avoiding the pattern
random-nick has quit [Ping timeout: 240 seconds]
<rotateq>
No special pattern, but what makes sense, not just cause some people decided what shall be what and everything else not.
aeth has quit [Ping timeout: 244 seconds]
aeth has joined #commonlisp
<aun>
Those patterns are meant to help you deal with certain situations one might encounter while designing applications. They are ready solutions. The situations are extremely generic
<aun>
If you can "leverage the power of Common Lisp" and improve any of those solutions you are welcome
<Alfr>
... also optional. Nothing prevents someone stubborn enough to whip up a giant tagbody.