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/>
dino_tutter has quit [Ping timeout: 256 seconds]
Algernon69 has quit [Ping timeout: 256 seconds]
dwhelan1890 has joined #commonlisp
dwhelan1890 has quit [Remote host closed the connection]
synchromesh has quit [Quit: WeeChat 4.0.5]
donlcn has quit [Ping timeout: 272 seconds]
robin_ is now known as robin
pve has quit [Quit: leaving]
istewart has joined #commonlisp
ronald_ has joined #commonlisp
ronald has quit [Read error: Connection reset by peer]
FragmentedCurve has quit [Quit: Leaving]
FragmentedCurve has joined #commonlisp
ronald_ has quit [Read error: Connection reset by peer]
kevingal has quit [Remote host closed the connection]
synchromesh has joined #commonlisp
ronald has joined #commonlisp
Algernon69 has joined #commonlisp
holycow has joined #commonlisp
agrosant has quit [Ping timeout: 264 seconds]
waleee has quit [Ping timeout: 260 seconds]
ronald_ has joined #commonlisp
Pixel_Outlaw has joined #commonlisp
ronald has quit [Ping timeout: 260 seconds]
agrosant has joined #commonlisp
tyson2 has joined #commonlisp
Inline has quit [Ping timeout: 260 seconds]
ymir has joined #commonlisp
occ has quit [Ping timeout: 264 seconds]
skeemer has quit [Ping timeout: 260 seconds]
occ has joined #commonlisp
ymir has quit [Quit: Leaving.]
Lord_of_Life has quit [Ping timeout: 264 seconds]
Lord_of_Life has joined #commonlisp
Algernon69 has quit [Ping timeout: 256 seconds]
ixelp has quit [Ping timeout: 268 seconds]
gilberth has quit [Ping timeout: 255 seconds]
ixelp has joined #commonlisp
Alfr has joined #commonlisp
gilberth has joined #commonlisp
decweb has quit [Ping timeout: 260 seconds]
puke has quit [Ping timeout: 264 seconds]
agrosant has quit [Ping timeout: 264 seconds]
dnhester` has quit [Ping timeout: 260 seconds]
tisanae has joined #commonlisp
dnhester` has joined #commonlisp
dnhester` has quit [Ping timeout: 256 seconds]
random-nick has quit [Ping timeout: 260 seconds]
Pixel_Outlaw has quit [Quit: Leaving]
Algernon69 has joined #commonlisp
dnhester` has joined #commonlisp
ronald_ has quit [Ping timeout: 260 seconds]
ronald has joined #commonlisp
dnhester` has quit [Ping timeout: 260 seconds]
akoana has quit [Quit: leaving]
tyson2 has quit [Remote host closed the connection]
decweb has joined #commonlisp
Pixel_Outlaw has joined #commonlisp
ryanbw has quit [Ping timeout: 268 seconds]
decweb has quit [Ping timeout: 260 seconds]
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #commonlisp
dnhester` has joined #commonlisp
chiselfuse has quit [Remote host closed the connection]
occ has quit [Ping timeout: 252 seconds]
chiselfuse has joined #commonlisp
dnhester` has quit [Ping timeout: 264 seconds]
pfdietz has quit [Ping timeout: 250 seconds]
occ has joined #commonlisp
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #commonlisp
josrr has quit [Remote host closed the connection]
<zyd> Is there some kind of "community standard" that implementations follow for the results of TYPE-OF? In both SBCL and CCL (type-of #b10) returns (INTEGER 0 4611686018427387903). In ECL, (type-of #b10) returns (INTEGER 2 2). Kinda weird.
<beach> I am not sure that the ECL value is conforming.
<aeth> interesting... the former is effectively saying positive-fixnum (the largest useful subtype of integer, except maybe fixnum or integer itself) and the latter is going for the narrowest
<zyd> Conforming? I read that type-of is implementation dependent?
<beach> Yes, but there are restrictions. Let me re-read...
<Mondenkind> aeth: how about positive-integer
<aeth> Mondenkind: technically, the same size as (and integer (satisfies evenp))
<aeth> which would be evil to do and hopefully isn't conforming
<Mondenkind> what are you getting at?
<Mondenkind> and I don't see what's evil about that
<beach> I guess it is conforming.
<aeth> Mondenkind: both the and and the satisfies
<Mondenkind> ah, sure, those are not conforming
<zyd> the ecl results seem less useful, though perspective of a noob
<beach> Indeed.
<aeth> yes
<Mondenkind> also. the cardinality of integer is the same as that of (integer 0) and (and integer (satisfies evenp)), while size is measured as the subtyping relation, so I don't think it's useful to say that that's 'technically the same size'
<Mondenkind> you might as well say that integer and string are the same size, since neither is a subtype of the other
tisanae has quit [Quit: WeeChat 4.1.2]
dnhester` has joined #commonlisp
dnhester` has quit [Ping timeout: 256 seconds]
Algernon69 has quit [Ping timeout: 256 seconds]
dnhester` has joined #commonlisp
dnhester` has quit [Ping timeout: 260 seconds]
rtypo has quit [Ping timeout: 268 seconds]
ronald_ has joined #commonlisp
ronald has quit [Read error: Connection reset by peer]
Algernon69 has joined #commonlisp
istewart has quit [Quit: Konversation terminated!]
msv has quit [Remote host closed the connection]
msv has joined #commonlisp
msv has quit [Remote host closed the connection]
msv has joined #commonlisp
iNomad has joined #commonlisp
AndreiDuma has joined #commonlisp
AndreiDuma has quit [Client Quit]
Algernon69 has quit [Ping timeout: 264 seconds]
dnhester` has joined #commonlisp
dnhester` has quit [Ping timeout: 255 seconds]
Algernon69 has joined #commonlisp
rgherdt has joined #commonlisp
waleee has joined #commonlisp
wacki has joined #commonlisp
dnhester` has joined #commonlisp
<younder> Where can I find the declaration for the structure of a symbol?
<beach> The definition, you mean? That is highly implementation specific.
<younder> How about in SICL
<younder> Thanks. How does it handle the separation of symbol, value and function?
<beach> Very good question...
<beach> The value and function of a symbol has to do with the global environment. But since most Common Lisp implementations have a single global environment, they can put those values in the symbol object.
Algernon69 has quit [Ping timeout: 256 seconds]
<beach> So their global environment is "spread out" over lots of different things.
<beach> We designed first-class global environments to avoid that, so with first-class global environments, the value and function are stored in cells in the environment.
<beach> You can read about that in the paper on first-class global environments.
<beach> Or you can study the code of Clostrum which is an implementation of the ideas in the paper.
<beach> With first-class global environments, the same symbol typically has different values and functions in different environments, which is the desired effect.
<beach> The standard hints at multiple global environments in the section on compilation semantics, but then goes right ahead and allows for all of them to be identical.
Inline has joined #commonlisp
<younder> Ok. Thanks. I have that paper. I'll look into it.
<beach> Sure. Good luck.
mgl has joined #commonlisp
shka has joined #commonlisp
<beach> I find it very unfortunate that the functions SYMBOL-VALUE and SYMBOL-FUNCTION are listed in the Symbols Dictionary in the standard, because it unfortunately hints that these functions are slot readers for SYMBOL objects. Similarly, I find it unfortunate that the chapter entitled "Environment" is not about operators related to the global environment(s).
<beach> I mean, SYMBOL-FUNCTION and FDEFINITION ought to be in the same place, but the latter is in the Data and Control Flow Dictionary.
pve has joined #commonlisp
dino_tutter has joined #commonlisp
alcor has joined #commonlisp
donlcn has joined #commonlisp
<beach> Here is an example of the unfortunate effects of a single global environment: If you create a file that contains (IN-PACKAGE #:COMMON-LISP-USER) (EVAL-WHEN (:COMPILE-TOPLEVEL) (DEFUN FOO (X) X)) and then (COMPILE-FILE <that file>), you will then have a function FOO in COMMON-LISP-USER: (COMMON-LISP-USER:FOO 234) => 234
<beach> There is absolutely no reason why this function should be defined after the compilation finishes.
dnhester` has quit [Ping timeout: 268 seconds]
amb007 has quit [Ping timeout: 260 seconds]
Algernon69 has joined #commonlisp
amb007 has joined #commonlisp
Inline has quit [Ping timeout: 268 seconds]
dnhester` has joined #commonlisp
skeemer has joined #commonlisp
_cymew_ has joined #commonlisp
Inline has joined #commonlisp
Lycurgus has quit [Quit: leaving]
phantomics has joined #commonlisp
phantomics_ has quit [Ping timeout: 255 seconds]
puke has joined #commonlisp
puke has quit [Remote host closed the connection]
puke has joined #commonlisp
dnhester` has quit [Ping timeout: 260 seconds]
_cymew_ has quit [Ping timeout: 252 seconds]
iNomad has quit [Ping timeout: 264 seconds]
iNomad has joined #commonlisp
tyson2 has joined #commonlisp
random-nick has joined #commonlisp
jon_atack has joined #commonlisp
dnhester` has joined #commonlisp
jonatack has quit [Ping timeout: 256 seconds]
a51 has quit [Quit: WeeChat 4.2.1]
ebrasca has joined #commonlisp
a51 has joined #commonlisp
mgl has quit [Ping timeout: 256 seconds]
Guest0 has joined #commonlisp
Guest0 has quit [Client Quit]
meritamen has joined #commonlisp
meritamen has left #commonlisp [#commonlisp]
meritamen has joined #commonlisp
occ has quit [Read error: Connection reset by peer]
<beach> clhs make-load-form-saving-slots
<ixelp> CLHS: Function MAKE-LOAD-FORM-SAVING-SLOTS
<beach> Why would MAKE-LOAD-FORM-SAVING-SLOTS need to call SLOT-MAKUNBOUND as the Notes section suggests?
_cymew_ has joined #commonlisp
green_ has joined #commonlisp
occ has joined #commonlisp
cage has joined #commonlisp
<_death> beach: why not?.. if an instance has some unbound slot that didn't get to that state by default that would make sense
<beach> I don't understand. The Notes section indicates that it calls ALLOCATE-INSTANCE and then fills in a slot only when it is both in the list of slots passed as an argument, and bound.
<beach> Or am I reading it wrong?
<_death> beach: ok, after allocate-instance the slot would be unbound already.. I can still see a difference if the class layout changed and the slot got removed.. then you'd expect slot-makunbound to call slot-missing gf
meritamen has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<beach> You mean if a slot name was supplied by the object has no such slot?
msv has quit [Remote host closed the connection]
<_death> yes
<beach> But then it wouldn't be SLOT-MAKUNBOUND that calls SLOT-MISSING but SLOT-BOUNDP.
<_death> or rather, I mean that the class was redefined between the generation of the load forms and their evaluation
msv has joined #commonlisp
msv has quit [Remote host closed the connection]
OlCe has quit [Remote host closed the connection]
msv has joined #commonlisp
<bike> I think that note is probably just incorrect
<beach> About SLOT-MAKUNBOUND?
<bike> Yeah, I don't see why m-l-f-s-s would need to makunbound.
<beach> Thanks!
<beach> I was expecting _death to say the same, but he didn't,
<_death> (defclass foo () ((a :initform 42))) (make-load-form-saving-slots ...) (defclass foo () ()) (evaluate-load-forms)
<_death> without slot-makunbound, a foo instance will get allocated but slot-missing won't be called
meritamen has joined #commonlisp
<younder> beach: Illustration of clostrum https://jthing.github.io/sicl-hugo/posts/clostrum/
<ixelp> Clostrum - SICL Compiler
<beach> younder: I see. But the SYMBOL class doesn't belong there.
<bike> hm, sbcl's m-l-f-s-s at least calls slot-makunbound
<bike> but clasp's doesn't. i wonder if there is a problem.
tyson2 has quit [Remote host closed the connection]
<_death> slot-missing is a gf that a user can add methods to, so the could be an expectation that it be called in that situation
<beach> bike: The result of calling it on SBCL suggests that it doesn't call ALLOCATE-INSTANCE but something else.
synchromesh has quit [Read error: Connection reset by peer]
<_death> beach: the creation form on sbcl is allocate-instance..
<beach> I wonder why they didn't write that then.
<_death> didn't write what?
synchromesh has joined #commonlisp
<beach> On my version, the value is (SB-KERNEL:NEW-INSTANCE ...) not (ALLOCATE-INSTANCE ...)
<bike> it looks like allocate-instance from the source here.
<younder> beach: It doesn't belong in clostrum, but it plays a central role so I threw it in.
<beach> I see.
<beach> Maybe I have an old version of SBCL.
<_death> anyway, I gave an argument for calling slot-makunbound, does it make sense?
<beach> Not to me.
<bike> yeah, i don't follow exactly what's happening when
<bike> if the issue is an inconsistent class definition between compile (serialization) time and load time, that's already undefined behavior, i think
<beach> _death: I don't see why SLOT-MISSING would not be called by SLOT-BOUNDP when the initializing form is executed and there is no such slot. But it is probably my usual slowness, so don't worry about it.
decweb has joined #commonlisp
<_death> beach: I should've put slot-makunbound form between the initial defclass and the make-load-form-saving-slots
<beach> _death: I don't see how that changes things.
tyson2 has joined #commonlisp
<beach> _death: Don't worry about it. I am probably not going to understand it in real time from your examples. I would need to go offline and think about it.
josrr has joined #commonlisp
yitzi has joined #commonlisp
<beach> younder: How is the SICL class SYMBOL involved in Clostrum?
<beach> younder: Clostrum is not particularly SICL specific.
<_death> beach: without the slot-makunbound form in the initialization form, the instance will be recreated and that's it.. with the slot-makunbound form, the slot-missing gf will be called because the new class definition has no slot A
<beach> _death: If the name of the missing slot is included in the slots to preserve, the initialization form would have to check whether the slot is bound or not, presumably using SLOT-BOUNDP, and then the SLOT-MISSING would be called. Are you saying that the initialization for should contain calls to SLOT-MAKUNBOUND for all the slots that were in the original object, but that are not mentions in the list of slots to preserve?
<beach> *not mentioned
<beach> *initialization form
<beach> *sigh*
<_death> beach: why would it have to explicitly check whether the slot is bound or not?
chiselfuse has quit [Read error: Connection reset by peer]
<beach> Because if it is mentioned in the slots to preserve, it can't just do SLOT-VALUE in case the slot is unbound.
<beach> Then the unboundness of the slot should be preserved.
<_death> right, it could just do slot-makunbound
<_death> but clhs note says "though other functions of similar effect might actually be used." so slot-boundp could be a good alternative, I guess
<beach> Good to know.
<beach> Anyway, I think I might see your point once I go offline and start thinking about it.
chiselfuse has joined #commonlisp
<_death> no problem, let me know :)
<beach> I will if I remember.
<_death> I did conflate a few things, sorry for that.. so the example could've been (defclass foo () (a)) (m-l-f-s-s ...) (defclass foo () ()) (evaluate-load-forms)
agrosant has joined #commonlisp
varjag has joined #commonlisp
rtypo has joined #commonlisp
Algernon69 has quit [Ping timeout: 260 seconds]
mgl has joined #commonlisp
Mandus has quit [Quit: WeeChat 4.1.1]
Mandus has joined #commonlisp
jonatack has joined #commonlisp
jon_atack has quit [Ping timeout: 256 seconds]
dnhester` has quit [Ping timeout: 256 seconds]
agrosant has quit [Ping timeout: 264 seconds]
gxt_ has quit [Quit: WeeChat 3.7.1]
dnhester` has joined #commonlisp
varjag has quit [Remote host closed the connection]
jon_atack has joined #commonlisp
jonatack has quit [Ping timeout: 268 seconds]
Algernon69 has joined #commonlisp
meritamen has quit [Quit: Textual IRC Client: www.textualapp.com]
donlcn has quit [Remote host closed the connection]
donleo has joined #commonlisp
jon_atack has quit [Ping timeout: 255 seconds]
jonatack has joined #commonlisp
yitzi has quit [Ping timeout: 246 seconds]
son0p has quit [Quit: Bye]
yitzi has joined #commonlisp
rgherdt_ has joined #commonlisp
rgherdt has quit [Ping timeout: 256 seconds]
rgherdt__ has joined #commonlisp
rgherdt_ has quit [Ping timeout: 256 seconds]
amb007 has quit [Ping timeout: 260 seconds]
amb007 has joined #commonlisp
son0p has joined #commonlisp
chiselfuse has quit [Ping timeout: 260 seconds]
bjorkintosh has joined #commonlisp
bjorkintosh has joined #commonlisp
chiselfuse has joined #commonlisp
chiselfuse has quit [Remote host closed the connection]
ebrasca has quit [Read error: Connection reset by peer]
chiselfuse has joined #commonlisp
mi6x3m has joined #commonlisp
<mi6x3m> beach, I just wanted to share that after our talk I decided to change my ignorant ways and setup slimv for neovim which integrates with swank nicely
<mi6x3m> a whole different experience but it has some rough edges :)
<beach> Great! Good luck!
<mi6x3m> thanks, the dubugger works outstanding out-of-the-box
<beach> Good!
<mi6x3m> and yes, error locations are shown quite well
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #commonlisp
rtypo has quit [Quit: WeeChat 4.2.1]
ronald_ has quit [Ping timeout: 272 seconds]
jonatack has quit [Quit: WeeChat 4.2.1]
Algernon69 has quit [Ping timeout: 256 seconds]
ronald has joined #commonlisp
dnhester` has quit [Ping timeout: 268 seconds]
waleee has quit [Ping timeout: 260 seconds]
cage has quit [Remote host closed the connection]
zetef has joined #commonlisp
cage has joined #commonlisp
prokhor__ has quit [Remote host closed the connection]
green_ has quit [Ping timeout: 264 seconds]
ello has quit [Quit: ZNC 1.8.2 - https://znc.in]
varjag has joined #commonlisp
jonatack has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
mi6x3m has quit [Ping timeout: 260 seconds]
jonatack has quit [Ping timeout: 264 seconds]
zetef has quit [Ping timeout: 260 seconds]
jonatack has joined #commonlisp
varjag has quit [Remote host closed the connection]
varjag has joined #commonlisp
dwhelan1890 has joined #commonlisp
dwhelan1890 has quit [Remote host closed the connection]
Algernon69 has joined #commonlisp
thonkpod_ has quit [Ping timeout: 246 seconds]
thonkpod_ has joined #commonlisp
<ixelp> GitHub - selwynsimsek/xmpp-repl: Communicate with a Lisp process over XMPP
Josh_2 has joined #commonlisp
tyson2 has joined #commonlisp
agrosant has joined #commonlisp
jonatack has quit [Ping timeout: 252 seconds]
waleee has joined #commonlisp
agrosant has quit [Ping timeout: 264 seconds]
waleee has quit [Ping timeout: 255 seconds]
Algernon69 has quit [Ping timeout: 272 seconds]
prokhor has joined #commonlisp
<Josh_2> Writing tests :sob:
zetef has joined #commonlisp
mgl has quit [Ping timeout: 255 seconds]
Inline has quit [Ping timeout: 252 seconds]
Inline has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
tyson2 has joined #commonlisp
tyson2 has quit [Read error: Connection reset by peer]
<paulapatience> younder: genreic and spesial
ronald has quit [Ping timeout: 260 seconds]
ronald has joined #commonlisp
lucasta has joined #commonlisp
trannus_aran has joined #commonlisp
<Kingsy> can someone give me some advice. is there a better way to write something like this -> https://bpa.st/2NDQ <- basically jus a bunch of incf and setf against struct slots. but but basically I don't want to do the incf and setf IF (slot-value snapshot 'wind-angle) is NULL or NIL, which is fine, I can just include a bunch of ifs around each statement set, but the function is going to end up HUGE. can I
<ixelp> View paste 2NDQ
<Kingsy> refactor? or is this a reasonable approach?
k_hachig has joined #commonlisp
<varjag> Kingsy: i'd use accessors/readers instead of slot-value to begin with
<varjag> unless you have some other reason
jonatack has joined #commonlisp
<Kingsy> varjag: yeah I will change that soon. this is just a first draft. but yep. noted.
<Kingsy> but that doesnt really help with the length of the function and he reptition needed.
zetef has quit [Ping timeout: 246 seconds]
Algernon69 has joined #commonlisp
<varjag> Kingsy: combine the setfs into one big expression
<varjag> they don't seem to be dependent on count increment order
<yitzi> Maybe make a class that encapsulates the running average...
<Kingsy> yitzi: what do you mean? its alread a struct. can you show me a basic example?
<reb> Kingsy: If you use a class instead of a struct, then you can use the WITH-SLOTS macro.
<yitzi> Yep. Give me sec
<yitzi> Use with-accessors
tyson2 has joined #commonlisp
<reb> Kingsy: Yes, I agree ... use WITH-ACCESSORS
<Kingsy> never used that before. let me have a look
<yitzi> Actually, I'm not totally clear what the totals are in your code. Can you describe a bit more
<yitzi> ?
lucasta has quit [Quit: Leaving]
<Kingsy> basically. I have a hash table, each key in the hash table contains X snapshots, around 120 of them, I want to iterate over them and add a count as to how many there are, and a total of all of the values added up. at the end I am going to divide them and get the average
<Kingsy> once I finish the entire thing I was going to share the code here to get some general advice. but these really long repetitive functions seemed wrong so I wanted to ask about these parts now before I finish (its nearly done)
<Kingsy> the combind function under basically just checks if the current value is higher or lower. the output will be the highese and lowest of the values in the current key on the hashtable. the ultiamte ouput is the high / low and average values
tyson2 has quit [Read error: Connection reset by peer]
rendar has quit [Ping timeout: 272 seconds]
<yitzi> Kingsy: Here is a simple class that has a count and total https://plaster.tymoon.eu/view/4198
a51 has quit [Quit: WeeChat 4.2.1]
<yitzi> When you want to add a value you just call accumulate.
<Kingsy> hmm I don't se how this makes it easier. if my class has 12 slots. I would have to repeat all of this 12 times?
<Kingsy> is the % before the total and count? important?
<yitzi> No, just a style thing
<yitzi> You would make an instance of this class the slot value
<yitzi> I'll add more details...
<Kingsy> but yeah, I would still need a total and a count 12 times,
<Kingsy> hahah I am sorry. tahnks for helping xplain
<Kingsy> clearly I am mising the point :D :D
<reb> I've got some moving average code ... it's a reasonable example of using WITH-SLOTS. https://plaster.tymoon.eu/view/4199
<Kingsy> reb: interesting tanks
<Kingsy> thanks*
X-Scale has joined #commonlisp
rendar has joined #commonlisp
k_hachig has quit [Ping timeout: 240 seconds]
ronald has quit [Ping timeout: 264 seconds]
ronald has joined #commonlisp
kamafam has joined #commonlisp
yitzi has quit [Ping timeout: 260 seconds]
waleee has joined #commonlisp
Algernon69 has quit [Ping timeout: 246 seconds]
nij- has joined #commonlisp
k_hachig has joined #commonlisp
cage has quit [Remote host closed the connection]
cage has joined #commonlisp
Alfr has quit [Read error: Connection reset by peer]
nij- has quit [Ping timeout: 264 seconds]
Alfr has joined #commonlisp
kamafam has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
cage has quit [Remote host closed the connection]
cage has joined #commonlisp
cage has quit [Remote host closed the connection]
cage has joined #commonlisp
cage has quit [Client Quit]
nij- has joined #commonlisp
alcor has quit [Remote host closed the connection]
alcor has joined #commonlisp
jonatack has quit [Ping timeout: 268 seconds]
trannus_aran has quit [Remote host closed the connection]
rtypo has joined #commonlisp
varjag has quit [Ping timeout: 256 seconds]
trannus_aran has joined #commonlisp
_cymew_ has quit [Ping timeout: 260 seconds]
varjag has joined #commonlisp
istewart has joined #commonlisp
nij- has quit [Ping timeout: 256 seconds]
Algernon69 has joined #commonlisp
adlai has joined #commonlisp
<adlai> Kingsy: reckon your CL fluency with the ratio between how frequently you write macrolet versus defun
<adlai> obviously, there are situations where exploration is simpler without immediately reaching for macros
X-Scale has quit [Ping timeout: 250 seconds]
<younder> marcrolet-symbol vs defconstant also
tyson2 has joined #commonlisp
<younder> sorry define-symbol-macro. (so much for fluency)
<aeth> personally, I'd say never use macrolet (especially inside of a macro!) because it basically creates an almost entirely invisible thing
<aeth> that looks like a function but isn't but your user may want to use it as a function and now they have no clue where (foo 42) is even coming from
<aeth> and it's symbol-macrolet, not macrolet-symbol... that one's a bit more justifiable because you can use it to create variations on with-accessors
<younder> aeth: yes spotted that too late.. can be used with with-slots as well
akoana has joined #commonlisp
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
synchromesh has quit [Read error: Connection reset by peer]
synchromesh has joined #commonlisp
<younder> I guess my point was - quote from from Hyperspec: A constant defined by defconstant can be redefined with defconstant. However, the consequences are undefined if an attempt is made to assign a value to the symbol using another operator, or to assign it to a different value using a subsequent defconstant.
synchrom1 has joined #commonlisp
<younder> So you cant count on a values defined as constant being used directly. It is accessed like variable. If you want as a synonym for the VALUE you define it with define-symbol-macro. Does that sound right?
<aeth> I'm assuming that redefining a constant is basically like redefining a macro or an inline function, though. Where if you don't basically recompile/reload everything, you're probably going to refer to stale data in places.
synchromesh has quit [Ping timeout: 256 seconds]
<aeth> what a symbol macro is useful for is for some real fun: ,(define-symbol-macro foo (values 1 2 3)) ,foo
<ixelp> (define-symbol-macro foo (values 1 2 3)) => FOO
tyson2 has quit [Remote host closed the connection]
<aeth> oh, it doesn't parse , without ,( outside of the start of a line
<aeth> ,(define-symbol-macro foo (values 1 2 3)) ,(progn foo)
<ixelp> (define-symbol-macro foo (values 1 2 3)) => FOO, also (progn foo) => 1; 2; 3
<aeth> You can have multiple values that look like one value. And other tricks.
<younder> Sounds more like code obfuscation to me ;)
<aeth> ,(progn (defparameter *v* (vector 1 2 3)) (define-symbol-macro y (aref *v* 1)) (print y) (setf (aref *v* 1) 3) (print y) (setf y 42) (print y) *v*)
<ixelp> ↩ 2 ↩ 3 ↩ 42 => #(1 42 3)
<Kingsy> adlai: sorry, I don't understand your comment.
<aeth> younder: so either you have values that look like a symbol, or an accessor (in this case aref) that looks like a symbol, and I think that's more what symbol macros are for
<younder> Right I was thinking of values that look like symbols.
<aeth> It is, obviously, way more obvious what you're doing if instead of define-symbol-macro you use symbol-macrolet instead... which is what with-accessors and with-slots are. Because then you have the with-foo close in code to where the "magic" is happening. Instead of having it in a global.
<younder> right
<aeth> defining and then using a (with-cartesian-coords (x y z) v ...) would behave a lot like my example except now you can actually see what's going on because the binding isn't global
<aeth> (where each would be declared ignorable because you're only using y)
Inline has quit [Quit: Leaving]
<bike> redefining a constant variable between compile and load time does work a lot like redefining a macro. the semantics are described in 3.2.2.3.
pve has quit [Quit: leaving]
amb007 has quit [Ping timeout: 260 seconds]
amb007 has joined #commonlisp
Algernon69 has quit [Ping timeout: 256 seconds]
k_hachig has quit [Ping timeout: 268 seconds]
shka has quit [Ping timeout: 256 seconds]
waleee has quit [Ping timeout: 252 seconds]
alcor has quit [Remote host closed the connection]
ello has joined #commonlisp
k_hachig has joined #commonlisp
Inline has joined #commonlisp
iNomad has quit [Quit: leaving]
amb007 has quit [Ping timeout: 260 seconds]
pillton has joined #commonlisp
Alfr has quit [Remote host closed the connection]
Alfr has joined #commonlisp
tfeb has joined #commonlisp
Alfr has quit [Read error: Connection reset by peer]
Alfr has joined #commonlisp
tfeb has quit [Client Quit]
molson has joined #commonlisp
Algernon69 has joined #commonlisp
<adlai> aeth: the whole point of macrolet is evaluating whether some local pattern is worth promoting to its own toplevel form, with all the compile-time side effects that result
<adlai> younder: I absolutely loathe symbol macros, although I use local ones for situations where C++ programmers would begin yakking about design patterns
jeffrey has quit [Remote host closed the connection]
<adlai> Kingsy: it was general advice about progressing from being disappointed with screenfulls of boilerplate to boasting of code with higher Kolmogrov complexity
yitzi has joined #commonlisp
<yitzi> adlai: symbol macros are required for with-slots and with-accessors.
dino_tutter has quit [Ping timeout: 264 seconds]
<adlai> and toenails keep growing no matter how many different colors of parentheses the IDE can highlight... still gotta clip them and throw away the clutter.
<yitzi> I don't know what to say to that.
random-nick has quit [Ping timeout: 260 seconds]
<adlai> /notice #commonlisp #.(metaphor (alexandria:random-elt (apropos-list "compost")))
<aeth> adlai: just % a defmacro or whatever... imo, macros should generally be global and symbol macros should generally be local (with some local with-foo symbol-macrolet abstraction defined via defmacro)
<aeth> and doing the latter (abstracting a local binding with a macro) over a macrolet (rather than symbol-macrolet) is just plain bad imo
<adlai> I don't think I've ever written define-symbol-macro, only local ones
jonatack has joined #commonlisp
<adlai> toplevel symbol-macrolet is still convenient when variable names or things like *** are changing while you work
<adlai> it's probably a musician habit rather than "real programmers wear a blue tie and horn-rimmed spectacles"
<adlai> aeth: I don't quite understand how you used #\% as a verb there; it could mean a bunch of different things
<aeth> well, real programmers know how to program for the LGP-30 drum memory
<adlai> was % the comment character for the assembler that forced you to use separate constants?
<aeth> adlai: in non-CL, % means mod(ulo), which is weird, because in math (normally not shy about using symbols) you'd probably just write the word
<aeth> but % in this context means to prefix with a %
<aeth> that is to say, when you want someone not to use a macro, you can just (defmacro %foo ...) instead of making it a macrolet
<adlai> well one possible interpretation was "quotient out a macro" although that is not language I've ever seen outside my own brain
<aeth> relying on convention to not use it rather than creating a macrolet that can be hard to figure out where the definition originates
<adlai> yeah I guess that is a common convention for "your warranty, if you had any, is now void"
* adlai prefers using long names so anyone deliberately calling them suffers vertical code
Jach has quit [Ping timeout: 272 seconds]
random-nick has joined #commonlisp
donleo has quit [Ping timeout: 260 seconds]
rgherdt__ has quit [Quit: Leaving]
tyson2 has joined #commonlisp
prxq has quit [Ping timeout: 255 seconds]
decweb has quit [Ping timeout: 272 seconds]