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/>
<dbotton> if I have macro (defmacro z (x)) is there any away to somehow get as a string what was textually passed as X not evaluating X ie ,X
<dbotton> so say passed (z *somesymbol*) I can print out somehow with format *somesymbol*
<White_Flame> in the body of the macro, Z will be bound to the symbol *SOMESYMBOL*
<White_Flame> so ,(format nil "~s" z) or whatever will stringify that
<ixelp> (format nil "~s" z) ERROR: Unbound variable: Z
<Noisytoot> z is the name of the macro, do you mean x?
<White_Flame> erm, X yes
ronald has quit [Ping timeout: 272 seconds]
<White_Flame> or inside the macro code, `(... (format t "~s" ',x) ...) will print the quoted/literal form of whatever was passed in X
<White_Flame> *macroexpanded code
<bike> ,(macrolet ((foo (x) (princ-to-string x))) (foo *somesymbol*))
<ixelp> => "*SOMESYMBOL*"
<dbotton> thanks will try
<Noisytoot> ,(macrolet ((foo (x) `',x)) (foo *somesymbol))
<ixelp> => *SOMESYMBOL
<White_Flame> ,(macrolet ((foo (x) (symbol-name x))) (foo *some-symbol*))
<ixelp> => "*SOME-SYMBOL*"
<White_Flame> for maximum brittleness
<dbotton> symbol-name not going to cut it if not passed a symbol I assume
<dbotton> I want the text of what X was passed
<bike> the object passed to the macro may not reflect the actual source text
<bike> for example, say you have (z #.(princ-to-string 4))
<bike> z would get "4", not "#.(princ-to-string 4)"
<dbotton> would still work I think for my needs
<bike> the reader has already finished by the time the macro expands
<ixelp> Snippet | IRCCloud
<dbotton> figure maybe that will help
Lord_of_Life_ has joined #commonlisp
<dbotton> the probe works in practice, my issue is want to be able to set the title to the symbol or even local symbol name passed in if no title
Lord_of_Life has quit [Ping timeout: 272 seconds]
<bike> you probably want format nil, format t will return nil
<dbotton> whooops
Lord_of_Life_ is now known as Lord_of_Life
<dbotton> thanks :)
<dbotton> tired..
waleee has quit [Ping timeout: 268 seconds]
random-nick has quit [Ping timeout: 260 seconds]
yitzi has quit [Ping timeout: 264 seconds]
yitzi has joined #commonlisp
PuercoPop has joined #commonlisp
jonatack has joined #commonlisp
ronald has joined #commonlisp
jmdaemon has quit [Ping timeout: 268 seconds]
yitzi has quit [Remote host closed the connection]
jmdaemon has joined #commonlisp
rtypo has quit [Ping timeout: 260 seconds]
jmdaemon has quit [Quit: ZNC 1.8.2 - https://znc.in]
jmdaemon has joined #commonlisp
dom2 has quit [Ping timeout: 256 seconds]
dom2 has joined #commonlisp
jmdaemon has quit [Ping timeout: 256 seconds]
josrr has quit [Remote host closed the connection]
notzmv has joined #commonlisp
notzmv has quit [Ping timeout: 260 seconds]
pfdietz has quit [Quit: Client closed]
pfdietz has joined #commonlisp
brokkoli_origin has quit [Ping timeout: 240 seconds]
brokkoli_origin has joined #commonlisp
decweb has quit [Ping timeout: 268 seconds]
snits has joined #commonlisp
bitspook has joined #commonlisp
wacki has joined #commonlisp
Pixel_Outlaw has quit [Quit: Leaving]
pfdietz has quit [Quit: Client closed]
zetef has joined #commonlisp
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
deadmarshal_ has quit [Remote host closed the connection]
shka has joined #commonlisp
jweeks has quit [Quit: Konversation terminated!]
chomwitt has joined #commonlisp
zxcvz has joined #commonlisp
pve has joined #commonlisp
deadmarshal_ has joined #commonlisp
zetef has quit [Ping timeout: 260 seconds]
istewart has quit [Quit: Konversation terminated!]
jonatack has quit [Read error: Connection reset by peer]
jonatack has joined #commonlisp
kenran has joined #commonlisp
jonatack has quit [Read error: Connection reset by peer]
jonatack has joined #commonlisp
varjag has joined #commonlisp
amb007 has quit [Ping timeout: 255 seconds]
amb007 has joined #commonlisp
admich1 has joined #commonlisp
dino_tutter has joined #commonlisp
bjorkint0sh has quit [Remote host closed the connection]
bjorkint0sh has joined #commonlisp
amb007 has quit [Ping timeout: 255 seconds]
amb007 has joined #commonlisp
King_julian has joined #commonlisp
jonatack has quit [Read error: Connection reset by peer]
amb007 has quit [Ping timeout: 260 seconds]
amb007 has joined #commonlisp
jonatack has joined #commonlisp
dom2 has quit [Ping timeout: 268 seconds]
bjork1intosh has joined #commonlisp
dom2 has joined #commonlisp
mgl_ has joined #commonlisp
danse-nr3 has joined #commonlisp
bjorkint0sh has quit [Ping timeout: 272 seconds]
attila_lendvai has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
theruran has quit [Quit: Connection closed for inactivity]
chomwitt has quit [Ping timeout: 255 seconds]
admich1 has quit [Ping timeout: 256 seconds]
admich1 has joined #commonlisp
zxcvz has quit [Quit: zxcvz]
admich1 has quit [Remote host closed the connection]
admich1 has joined #commonlisp
danse-nr3 has quit [Ping timeout: 260 seconds]
danse-nr3 has joined #commonlisp
zetef has joined #commonlisp
rtypo has joined #commonlisp
synchromesh has quit [Read error: Connection reset by peer]
synchromesh has joined #commonlisp
zetef has quit [Ping timeout: 240 seconds]
zetef has joined #commonlisp
zetef has quit [Remote host closed the connection]
zetef has joined #commonlisp
donleo has joined #commonlisp
zetef has quit [Remote host closed the connection]
donleo has quit [Remote host closed the connection]
donleo has joined #commonlisp
random-nick has joined #commonlisp
pfdietz has joined #commonlisp
_cymew_ has joined #commonlisp
decweb has joined #commonlisp
gpiero_ is now known as gpiero
zetef has joined #commonlisp
X-Scale has quit [Quit: Client closed]
yitzi has joined #commonlisp
amb007 has quit [Ping timeout: 255 seconds]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
kenran has quit [Ping timeout: 260 seconds]
amb007 has joined #commonlisp
zetef has quit [Ping timeout: 256 seconds]
danse-nr3 has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
tok has joined #commonlisp
yitzi has quit [Read error: Connection reset by peer]
yitzi has joined #commonlisp
danse-nr3 has quit [Ping timeout: 252 seconds]
ocra8 has joined #commonlisp
zetef has joined #commonlisp
zetef has quit [Ping timeout: 268 seconds]
King_julian has quit [Read error: Connection reset by peer]
King_julian has joined #commonlisp
msv has quit [Ping timeout: 264 seconds]
msv has joined #commonlisp
danse-nr3 has joined #commonlisp
admich1 has quit [Ping timeout: 255 seconds]
admich1 has joined #commonlisp
bigbookofbug has joined #commonlisp
edgar-rft_ has joined #commonlisp
edgar-rft has quit [Ping timeout: 240 seconds]
metsomedog has joined #commonlisp
chomwitt has joined #commonlisp
josrr has joined #commonlisp
cdegroot has joined #commonlisp
bigbookofbug has quit [Quit: Lost terminal]
waleee has joined #commonlisp
synchromesh has quit [Read error: Connection reset by peer]
synchromesh has joined #commonlisp
varjag has quit [Quit: ERC (IRC client for Emacs 27.1)]
jonatack has quit [Ping timeout: 272 seconds]
King_julian has quit [Ping timeout: 240 seconds]
admich1 has quit [Ping timeout: 272 seconds]
bigbookofbug has joined #commonlisp
admich1 has joined #commonlisp
edgar-rft_ is now known as edgar-rft
X-Scale has joined #commonlisp
zetef has joined #commonlisp
danse-nr3 has quit [Ping timeout: 268 seconds]
metsomedog has quit [Remote host closed the connection]
waleee has quit [Ping timeout: 264 seconds]
jonatack has joined #commonlisp
metsomedog has joined #commonlisp
danse-nr3 has joined #commonlisp
josrr has quit [Remote host closed the connection]
danse-nr3 has quit [Ping timeout: 255 seconds]
josrr has joined #commonlisp
danse-nr3 has joined #commonlisp
alcor has joined #commonlisp
theruran has joined #commonlisp
mgl_ has quit [Ping timeout: 256 seconds]
zetef has quit [Ping timeout: 256 seconds]
danse-nr3 has quit [Read error: Connection reset by peer]
danse-nr3 has joined #commonlisp
ym has joined #commonlisp
waleee has joined #commonlisp
msv has quit [Remote host closed the connection]
admich1 has quit [Read error: Connection reset by peer]
admich1 has joined #commonlisp
danse-nr3 has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
wacki has joined #commonlisp
danse-nr3 has quit [Ping timeout: 252 seconds]
danse-nr3 has joined #commonlisp
<alcor> I've read G. Kiczales' paper on AOP and on "weaving" aspects in CL. That helped me simplify some code. But one thing I'm still unsure of is about the "best way" to wire components together in CL. Right now I do that simply via passing functions – I suppose this is one way it could be done in CL, even for complex software.
<alcor> For example, let's assume you have a function F(X) that constructs a complex object from an Input X by performing several queries on an SQL database and transforming the results. So instead of F(X), you use F(QUERY,X) as the signature where QUERY(SQL) → ROWS is a function.
dmgk has quit [Quit: ZNC - https://znc.in]
dmgk has joined #commonlisp
danse-nr3 has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
<alcor> The question is if there's something more than passing funcallables around. It seems most CL code uses some variation of it, e.g. Norvig's "Protocol Method" Pattern with iteration-protocol(object) => state, limit, next, done?, current.
alcor has quit [Remote host closed the connection]
alcor has joined #commonlisp
<_death> sure.. for example you can pass an instance and drive the operation with the help of generic functions
<alcor> _death: But in this case, who *owns* the generic functions? The provider side or the consumer side?
<alcor> Or rather, let's say the "providing component" and "consumer component"
<alcor> Or is it best to package them up in a separate package that only defines the protocol, and have both sides depend on it?
<_death> the question assumes context that I don't have
<alcor> Okay, so "whatever makes sense for your context" I guess.
<_death> in general when defining a generic function you have a certain audience in mind.. often it's composed primarily of the users who are supposed to define methods for it.. an interface that's convenient for callers may need different ergonomics and so a different generic function or some other mechanism
random-nick has quit [Ping timeout: 255 seconds]
dmgk has quit [Quit: ZNC - https://znc.in]
dmgk has joined #commonlisp
<_death> you also have to keep in mind that abstractions have costs and try to avoid overpaying, so sometimes passing a function makes sense, sometimes a more involved protocol makes sense, sometimes a different architecture makes sense, and sometimes the most naive and concrete function interface makes sense..
dmgk has quit [Client Quit]
dmgk has joined #commonlisp
<yottabyte> I'm trying to get a string of json with yason, trying like (yason:with-output-to-string* () (yason:encode '(1 2 3) t)) and this prints out the string, but it still returns ""
<_death> what's the purpose of passing T to encode
admich1 has quit [Ping timeout: 256 seconds]
dmgk has quit [Quit: ZNC - https://znc.in]
dmgk has joined #commonlisp
jon_atack has joined #commonlisp
<yitzi> Try `(with-output-to-string (s) (yason:encode '(1 2 3) s))`
jonatack has quit [Ping timeout: 264 seconds]
random-nick has joined #commonlisp
cage has joined #commonlisp
<yitzi> `(yason:with-output-to-string* () (yason:encode '(1 2 3)))` also works
jon_atack has quit [Read error: Connection reset by peer]
ocra8 has quit [Ping timeout: 268 seconds]
ronald has quit [Ping timeout: 268 seconds]
jonatack has joined #commonlisp
<yottabyte> ah, yes, that works
<yitzi> There are other JSON libs out there. Sabra has a good review of them, btw.
ronald has joined #commonlisp
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
admich1 has joined #commonlisp
ocra8 has joined #commonlisp
<yottabyte> what's Sabra?
<ixelp> Sabra's Occasional Comments
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
varjag has joined #commonlisp
qhong has quit [Read error: Connection reset by peer]
qhong has joined #commonlisp
<edgar-rft> Sabra is Satan's bra
jonatack has quit [Ping timeout: 268 seconds]
amb007 has quit [Ping timeout: 260 seconds]
amb007 has joined #commonlisp
wacki has joined #commonlisp
<yottabyte> oh wow, this is a comprehensive overview. I will definitely check this out
wacki has quit [Read error: Connection reset by peer]
wacki has joined #commonlisp
<yottabyte> I was reading the spec on how to use with-output-ti-string*, but it's so hard to discern what "with-output-to-string* (&key indent stream-symbol) &body body => result*" even means
<yitzi> Ident presumably controls indentation. if you don't supply stream-symbol it uses the default `*json-stream*` dynamic variable, which also the default to encode, which why you don't need to worry about it.
synchromesh has quit [Ping timeout: 260 seconds]
dtman34 has quit [Quit: ZNC 1.8.2+deb3.1 - https://znc.in]
dtman34 has joined #commonlisp
danse-nr3 has quit [Ping timeout: 260 seconds]
<yitzi> In other words, you probably only need to use `(yason:with-output-to-string* () ...)` or `(yason:with-output-to-string* (:indent t) ...)`
jonatack has joined #commonlisp
mgl_ has joined #commonlisp
admich1 has quit [Ping timeout: 252 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<yottabyte> is a library that allows for hash table literals? one pain point I'm having is created nested hash tables with make-hash-table. my objects aren't very complex, but can be nested a decent amount
<yitzi> Are asking about which JSON lib?
<yitzi> "Are you"
<yottabyte> not necessarily, yason seems to be doing what I need right now. I just mean in general, working with tables more conveniently in cl. then I can encode them as json
<yitzi> alexandria has some hash table conversion functions
<yitzi> shasht also has make-object for convenience.
admich1 has joined #commonlisp
<metsomedog> yottabyte: if you are using small hash tables, have you considered alists? might be more convenient to create "literally" and to iterate over
<yottabyte> Oh, true. And encoding them as json with yason would yield json objects like I expect?
<metsomedog> I'm not familiar with json encoding sadly, just in general alists are quite convenient and afaik they are faster than hash tables until you have about 20-30 elements
<yitzi> It depends on the JSON lib.
<metsomedog> you can easily convert between alists/plists/hash tables using alexandria as well, as was mentioned above
<metsomedog> for example ALEXANDRIA:ALIST-HASH-TABLE ALEXANDRIA:HASH-TABLE-ALIST or plist equivalents
jonatack has quit [Ping timeout: 256 seconds]
<metsomedog> (alexandria:plist-hash-table '(a 1 b 2 c 3))
<metsomedog> after checking quickly on the awesome-cl I see that at least "jonathan" and "shasht" json libraries seem to support alists
<metsomedog> the awesome-cl repo*
<yitzi> Yes, I use them in shasht for throw-away serialization data also. You can mix them with hash-tables with an keyword identifier.
<yottabyte> good info, thanks!
<yitzi> So when you don't want to make a hash table, but want to use backquote and comma: https://github.com/yitzchak/shasht?tab=readme-ov-file#json-array-and-object-literals
<ixelp> GitHub - yitzchak/shasht: Common Lisp JSON reading and writing for the Kzinti.
<metsomedog> another nice quality about alists is that you can search for a match by the value as well
<metsomedog> (value of key-value pair)
bitspook has quit [Ping timeout: 250 seconds]
mgl_ has quit [Ping timeout: 268 seconds]
monospod has joined #commonlisp
<josrr> yottabyte: yason supports alists https://plaster.tymoon.eu/view/4311#4311
admich1 has quit [Remote host closed the connection]
admich1 has joined #commonlisp
shka has quit [Quit: Konversation terminated!]
monospod has quit [Quit: Konversation terminated!]
jmdaemon has joined #commonlisp
admich1 has quit [Ping timeout: 240 seconds]
admich1 has joined #commonlisp
_cymew_ has quit [Ping timeout: 255 seconds]
mgl_ has joined #commonlisp
yitzi has quit [Remote host closed the connection]
ym has quit [Quit: Leaving]
cage has quit [Quit: rcirc on GNU Emacs 29.3]
mgl_ has quit [Ping timeout: 252 seconds]
attila_lendvai has quit [Ping timeout: 256 seconds]
pfdietz has quit [Ping timeout: 250 seconds]
jmdaemon has quit [Ping timeout: 240 seconds]
metsomedog has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3)]
anticomputer has quit [Remote host closed the connection]
anticomputer has joined #commonlisp
markb1 has quit [Read error: Connection reset by peer]
dom2 has quit [Ping timeout: 256 seconds]
chomwitt has quit [Ping timeout: 260 seconds]
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
dom2 has joined #commonlisp
mesaoptimizer has quit [Quit: mesaoptimizer]
mesaoptimizer has joined #commonlisp
jmdaemon has joined #commonlisp
markb1 has joined #commonlisp
<fitzsim> green_: nice recipe, thanks! I will try it out on ppc64le; last time I looked "shrinkwrapping" was x86-64 specific, whereas daewok's approach worked on ppc64le
brokkoli_origin has quit [Ping timeout: 256 seconds]
jmdaemon has quit [Ping timeout: 260 seconds]
jmdaemon has joined #commonlisp
puke has quit [Read error: Connection reset by peer]
josrr has quit [Remote host closed the connection]
josrr has joined #commonlisp
josrr has quit [Remote host closed the connection]
dino_tutter has quit [Ping timeout: 256 seconds]
josrr has joined #commonlisp
Pixel_Outlaw has joined #commonlisp
jmdaemon has quit [Ping timeout: 264 seconds]
brokkoli_origin has joined #commonlisp
amb007 has quit [Remote host closed the connection]
amb007 has joined #commonlisp
notzmv has joined #commonlisp
alcor has quit [Ping timeout: 260 seconds]
char has joined #commonlisp
jonatack has joined #commonlisp
pve has quit [Quit: leaving]
msv has joined #commonlisp
msv has quit [Remote host closed the connection]
msv has joined #commonlisp
pfdietz has joined #commonlisp
donleo has quit [Ping timeout: 255 seconds]
varjag has quit [Ping timeout: 240 seconds]
admich1 has quit [Ping timeout: 255 seconds]
brokkoli_origin has quit [Ping timeout: 260 seconds]
admich1 has joined #commonlisp
brokkoli_origin has joined #commonlisp
jonatack has quit [Ping timeout: 264 seconds]