Xach 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>
xsperry has joined #commonlisp
Oladon has joined #commonlisp
igemnace has joined #commonlisp
asen has joined #commonlisp
_73 has joined #commonlisp
asen has quit [Read error: Connection reset by peer]
asen has joined #commonlisp
VincentVega has quit [Remote host closed the connection]
Lycurgus has quit [Quit: Exeunt]
<_73> I am trying to define a constant hash-table with `defconstant` by calling a lambda function that returns a hash. When I try to compile it however I get an error that I am trying to redefine the variable, even though I have not previouly defined the constant. Here is the code and error: http://dpaste.com/7M56CUYDN
<Catie> _73: Is this under SBCL?
<_73> yes
<Catie> That's just how it handles defconstant forms
<Catie> Nope that link doesn't work
<Guest74> I've wondered if somebody has created a perfect hash table for CL.
<semz> define-constant is a part of alexandria by the way
<_73> Catie: I understand now. Would you reccomend just using defvar and being careful, or is there a library that provides a macro that does the right thing like in the docs
<semz> lol
<_73> semz: you read my mind
<pjb> or rather, if you don't want to have anybody use (setf gethash), provide your own immutable API.
<Catie> I guess what I usually do is just use defvar, I only use defconstant for very simple constants. I don't know that I'd call it a recommendation though
<pjb> the fact that the point of constant variables in CL is to be give a hint to the compiler that it can inline the value (that should therefore be immutable).
<pjb> With most processors, only small integers and characters can be put inline with the code. And perhaps a reference, aka a pointer, to things like symbols that are essentially immutable (you cannot change the name of a symbol).
<pjb> binding a constant variable to anything else doesn't bring anything.
<_73> I want a guarantee that the hash wont be mutated
<pjb> (defclass immutable-hash () ((hash-table :initarg :hash-table :reader hash-table))) (defmethod get-ih (key (table immutable-hash)) (gethash key (hash-table table))) (defvar *table* (make-instance 'immutable-hash :hash-table (let ((h (make-hash-table))) (setf (gethash :k1 h) 'v1 (gethash :k2 h) 'v2) h)))
<pjb> _73: ^ there. Then nothing can change the entries in *table*, since the only operator you have is get-ih which cannot change them.
<_73> Ill study this thank you
<pjb> You can even :reader %hash-table and not export it.
<White_Flame> pjb: there is a very slight advantage in defconstant for references, avoiding an indirection and a TLS check
<White_Flame> vs defvar etc
<semz> It documents intent I suppose, and iirc SBCL is not very happy if you use the +constant+ convention for defvar/defparameter. If alexandria is already a dependency, using define-constant instead costs nothing (as opposed to ε otherwise).
<White_Flame> but of course you'd have to be accessing that a lot in a tight inner loop to matter
<Nilby> Keep in mind that unless you're doing something unusual, it's really only developers who keep recompiling/reloading code, that see defconstant redefinitions.
<pjb> _73: of course, it's conventionnal. With closures you could ensure a little restrictions, but even with closures, implementations usually have debugging features to inspect and mutate the contents of a closure.
<White_Flame> _73: (defconstant +foo+ <whatever>) doesn't guarantee that the <whatever> won't be mutated; it guarantees that +foo+ won't be mutated. If <whatever> is a hashtable, +foo+ is just a constant reference to it.
<White_Flame> and the compiler might inline references to that hashtable object in code that references it. But that doesn't prevent mutating the hashtable's contents
<Catie> Would you have to alias +foo+ to be able to mutate it, or can you directly (setf (gethash +foo) ...)?
<pjb> (setf (gethash key +foo+) value) doesn't mutate the binding +foo+, so it's valid.
<semz> afair there is no way in CL to indirectly change a binding
<White_Flame> by the way, the fact that the compiler can inline references to your defconstant values is why it complains about redefining defconstant with a new hashtable when you re-evaluate (defconstant +foo+ (make-hash-table)) again, since the prior compiled code points to the old hashtable
<semz> symbol macros don't count
<semz> I guess progv might
<Guest74> so, any minimal perfect hash tables in CL?
mariari has quit [Quit: WeeChat 3.3]
mariari has joined #commonlisp
<White_Flame> Guest74: if that means one with a perfect hash function, isn't that super dependent on the type of key being stored?
<Guest74> I'm not a hashing connoisseur :)
<Guest74> but I'd love to use one.
<White_Flame> if you give a perfect custom hash function to a supporting implementation's regular hash tables, they'll be O(1) anyway
<White_Flame> you'd have to do the 'minimal' feature manually, though, by giving it its size up front
<White_Flame> so the tools are all there for you, budding hashing connoiseur ;)
<Guest74> a minimal perfect hash table would have less indirection than the hash tables we have.
<Guest74> and of course my needs are for tables that are complete and wouldn't be added to.
<White_Flame> right, reusing a standard hash table would be O(1)+k overhead
<Alfr> Guest74, unless you plan to lookup key/values only (almost always) and not (almost never) modify the table's content, maintaining a minimal perfect hash table isn't wort the overhead.
<Guest74> Alfr: that's what I want them for.
<Guest74> e.g. svg colours, x11 colours, keysyms
<Alfr> Guest74, CL doesn't specify one; and iirc the hard part is only to guess a appropriate hash function for the given keys, as you don't need to care about hash collisions, empty entries etc.
<semz> I don't see how this is a use case for a perfect hash table to be honest. Surely you'd want to handle invalid data by the (e.g. X11) server or check that the library user provides a valid symbol.
<semz> or is this an internal thing
<Alfr> Guest74, you may want to simply drop the requirement for the hash-function to be minimal, essentially exchanging memory for reasonable table construction times.
<Alfr> Guest74, though then you have to deal with empty entries again.
<Guest74> semz: colour palettes don't change.
<Guest74> Alfr: construction time doesn't matter if it only has to be constructed once.
igemnace has quit [Remote host closed the connection]
<hayley> When in doubt, (defun hash (object) (declare (ignore object)) 1) is a perfectly fine hash function.
<White_Flame> Guest74: if your keys are symbols, then storing the color lookups in the symbol-plist would probably be faster & smaller than a hashtable
<White_Flame> and the overall overhead would depend on how often you manifest them as strings that need to be interned
<Guest74> some colour palettes are large. Keysyms are in the thousands.
<White_Flame> and you're going to have all of them in memory at once, right?
<_73> Guest74: We want similar things. An internal database of immutable program facts that is optimized for read operations. This is something that is intrinsic and natural to do in Prolog.
<semz> Guest74: What does that have to do with whether the other end of the connection or the user provides correct data? Unless the entire range is assigned (which I doubt, but I haven't checked), this is possible so you'd need a separate validation step anyway - and a normal hash table can do this (because a false key would be missing).
random-nick has quit [Ping timeout: 264 seconds]
<Guest74> semz: i don't understand what you're getting at. If a user types a wrong key? why would that break anything?
<Guest74> _73: yup, a perfect use for a minimal perfect hash table imo.
<White_Flame> minimal only saves some static memory footprint, which isn't going to be much. perfect saves some (hopefully nondegenerate) few key comparisons. I wouldn't consider it all that great for a mostly static lookup table, unless there are really egregious circumstances
<semz> Guest74: A minimal perfect hash is a bijection from some pre-defined key set to some value set. But your code may not actually hand it a value that lies in the key set, e.g. due to user error or a misbehaving/malicious party on the other side of the connection. In that case, your implementation will either error out or compute a completely wrong value and continue with that. So you need some sort of validation that the input lies in the key set anyway.
<Alfr> White_Flame, it's not entirely free, there's a theorem stating that the hash function must be at least of size ln(2) bits/entry.
<Alfr> White_Flame, s/entry/key/
<semz> And a normal hash table gives you that
<Guest74> semz: errors are good. they tell you you're doing something wrong.
<White_Flame> I didn't say it was free, but it's hard to consider that these costs in these situations are worth much
<semz> ???
<White_Flame> and the nice thing about using symbols is that it precomputes a lot of this
<White_Flame> and allows an :eq hashtable, if used
<White_Flame> (erm, 'eq hashtable :-P)
<Guest74> and allows documentation
<semz> Yes, which is why the error should be from your code, and not some internal thing from the hash table implementation that may or may not trigger at all
<White_Flame> and if size+speed was still a concern, I'd seriously consider the symbol-plist off that
<Guest74> semz: I don't know what you're arguing. That some implementation that doesn't seem to exist will be written poorly?
<semz> Or that somebody is having "fun" with someone running whatever software ends up using it and manages to coax the program into doing something stupid.
<semz> The point I'm arguing is that this problem doesn't even exist if you use the simpler implementation - a normal hash table.
<semz> As far as I can tell, you're trading correctness and a lot of effort for basically nothing
<Guest74> I think the point you're arguing exists regardless if you're using hashtables at all. To say it is a problem with a minimal perfect hash table that doesn't seem to be implented yet, well, i don't know what to think about that.
<Guest74> White_Flame: I've thought of just using packages as 'hash tables'.
<Bike> isn't the issue that a minimal perfect hash table by definition is not defined for unexpected inputs, and will in fact return some random crap instead of signaling an error
<semz> yes
<semz> that is precisely the issue
<Alfr> Guest74, it's perfectly reasonable for a gethash like function for a minimal perfect hash table to return any object or even read out of bounds. Given the hash function, it doesn't even need to store the keys, as any key provided will by the very definition of perfect hashing map to some position the implementation assumes to store the key's vale. So, it you feed it something which isn't one of the original keys, the results might be quite unexpected.
<Bike> so how you implement the minimal perfect hash table doesn't matter.
Catie has quit [Quit: going home]
<Bike> like, if it can recognize an unexpected input and do something else, it's not a minimal perfect hash table.
<Guest74> hey, i'm fine with that.
<White_Flame> Bike: it's always just a hash function & fixed array anyway
<White_Flame> hmm, well maybe for 1 class of them I guess
<Bike> yeah but if you want The Speed then you skip the boring stuff you do in a general hash table like make sure the key is actually equivalent
<semz> Guest74: This isn't flamebait, I'd sincerely like to know this. Do you have C/C++ experience?
<Guest74> No, but what does that have to do with lisp?
<semz> It has to do with going for design decisions like these.
<Guest74> sure, if it was programmed in c/c++
<Guest74> we can always ask Vseloved if he ran into any problems. I'll have to check out his library.
<Guest74> if you store the key with the value you just check that they are eq before returning whatever the hash pointed to. If you want to reduce the problems of malicious software or continous user error. still seem to get more speed and less memory if that's you're concern.
hexology is now known as hexology_
hexology_ is now known as hexology__
hexology__ is now known as hexology`
hexology` is now known as hexology_`
hexology_` is now known as hexology
OlCe has quit [Ping timeout: 256 seconds]
<_73> What do you think of this general pattern for a closure that can perform dynamic dispatch? http://dpaste.com/6WNBXQGKP
Lord_Nightmare has quit [Quit: ZNC - http://znc.in]
<_73> (assuming I quoted the people lists)
ec_ has quit [Remote host closed the connection]
Lord_Nightmare has joined #commonlisp
<Bike> _73: case doesn't evaluate the keys, so you don't want those quotes. also, usually one would just use defstruct or defclass.
<Bike> also if you do it this way you don't need an alist, you can just close over three variables, and the binding shouldn't be special.
Oladon has quit [Quit: Leaving.]
<Bike> oh wait, it's an alist of people. never mind that part.
<_73> If I were to use a struct for `people` instead of a length 3 list do I gain anything in type safety?
akoana has quit [Quit: leaving]
<Guest74> well, you can declare the types of the struct slots.
<Bike> sure, it means you don't get garbage out if you accidentally have (fred ("aggravated assault" "23 years")) in there
<pjb> _73: if by "type safety" you mean the implementation can perform more checks, then yes.
<Bike> and also i just noticed you have your persons unquoted, so that won't work
<_73> Guest74: right that is a given but does not matter if I never plan on inserting into the alist
<_73> ok a struct clearly makes more sense
<Bike> i could write this something like (defstruct person gender age marital) (defvar *people* (list (cons 'fred (make-person ...)) ...))
<pjb> Or even not consing a key, just the structs.
<Bike> and then maybe (defun gender (name) (person-gender (cdr (assoc name *people*)))) etc instead of the dispatch thing
<Guest74> I love structs. Most people will push you towards classes.
<Bike> also, just realized there's another bug, since assoc returns the pair rather than the value your code won't work
<pjb> (defstruct person name gender age marital) (defparameter *persons* (list (make-person :name "Bill") (make-person :name "Mary")))
<pjb> (find "Mary" *persons* :key (function person-name) :test (function string-equal)) #| --> #S(person :name "Mary" :gender nil :age nil :marital nil) |#
<Bike> really i read too quickly because i read "closure that can perform dynamic dispatch" and thought of the scheme pattern of using closures as objects, but you're not actually doing that here. in fact, if *people* is a special variable like it looks like, there's not even a closure involved
<_73> Bike: I see that I misused the ** convention.
<_73> But this is a lexical variable
prxq_ has quit [Ping timeout: 256 seconds]
OlCe` has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
Guest74 has quit [Quit: Connection closed]
Guest74 has joined #commonlisp
<Guest74> oops, i think I need more dbus services besides firefox. Just crashed my browser testing a function. This dbus implementation seems like less of a good idea now that I see there's not much there if you aren't running kde or gnome.
asen has quit [Quit: Leaving]
s-liao has joined #commonlisp
x88x88x has joined #commonlisp
taiju has quit [Ping timeout: 264 seconds]
poselyqualityles has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
s-liao has joined #commonlisp
taiju has joined #commonlisp
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #commonlisp
<beach> Good morning everyone!
Lycurgus has joined #commonlisp
pdietz has quit [Ping timeout: 256 seconds]
attila_lendvai has quit [Ping timeout: 264 seconds]
x88x88x has quit [Ping timeout: 264 seconds]
Bike has quit [Quit: Lost terminal]
<phantomics> Morning beach, is anyone around here using Allegro CL? If so I have something amusing for you to try
semz has quit [Ping timeout: 268 seconds]
Lycurgus has quit [Quit: Exeunt]
<ns12> Does "Object-Oriented Programming in COMMON LISP: A Programmer's Guide to CLOS" by Sonya E. Keene describe CLOS as it appears in ANSI Common Lisp? Or is the book about pre-ANSI CLOS?
s-liao has quit [Ping timeout: 256 seconds]
cjb has quit [Quit: rcirc on GNU Emacs 29.0.50]
poselyqualityles has quit [Ping timeout: 264 seconds]
semz has joined #commonlisp
Guest74 has quit [Ping timeout: 264 seconds]
tyson2 has quit [Remote host closed the connection]
<beach> ns12: It is an accurate description.
<beach> ns12: ANSI pretty much incorporated CLOS as it was defined, or the subset that was necessary for the standard.
waleee has quit [Quit: WeeChat 3.3]
<beach> ns12: Hello?
rain3 has joined #commonlisp
<ns12> beach: Sorry, I was away. Thank you for the information.
<beach> Sure.
shka has joined #commonlisp
rain3 has quit [Remote host closed the connection]
rain3 has joined #commonlisp
s-liao has joined #commonlisp
Cymew has joined #commonlisp
aartaka has joined #commonlisp
jeosol has quit [Ping timeout: 256 seconds]
Algernon69 has joined #commonlisp
Algernon91 has joined #commonlisp
makomo has quit [Ping timeout: 252 seconds]
pve has joined #commonlisp
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
Algernon69 has quit [Ping timeout: 250 seconds]
aartaka has quit [Ping timeout: 252 seconds]
gaqwas has joined #commonlisp
ldb has joined #commonlisp
amb007 has quit [Ping timeout: 256 seconds]
aartaka has joined #commonlisp
amb007 has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
cosimone has joined #commonlisp
ldb has quit [Remote host closed the connection]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
dre has quit [Quit: Leaving]
kingofcsu has joined #commonlisp
gaqwas has quit [Ping timeout: 264 seconds]
VincentVega has joined #commonlisp
kevingal has joined #commonlisp
lisp123 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
waleee has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 256 seconds]
Lord_of_Life_ is now known as Lord_of_Life
waleee has quit [Ping timeout: 252 seconds]
s-liao has joined #commonlisp
waleee has joined #commonlisp
frgo has quit [Ping timeout: 256 seconds]
kingofcsu has quit [Ping timeout: 252 seconds]
OlCe` has quit [Quit: ERC (IRC client for Emacs 27.1)]
OlCe has joined #commonlisp
pillton has quit [Quit: ERC (IRC client for Emacs 27.2)]
s-liao22 has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
<VincentVega> So, in a situation like this https://pastebin.com/Ft6qYNMa , what can I do to optimize away the WHEN clause? Any way to declare FLAG constant?
Guest746 has joined #commonlisp
<phoe> for a single flag I'd do (defun builds (flag) ... (if flag ...))
<phoe> no closure this way
<phoe> that's slightly subpar because it leads to code duplication, but you do seem to want code duplication - you want to return different functions depending on the value of flag
<phoe> one of which always prints and one of which never prints
<phoe> but, good golly, I hope you don't use microoptimizations like these for simple functions like that
<VincentVega> phoe: yeah, I was wondering if I could do away with code duplication.
<VincentVega> nah, this one is just for a discussion
<phoe> VincentVega: not really; you basically want to return different anonymous functions based on the value of FLAG
<phoe> and LAMBDA is not a good abstraction for that, because it always describes a single body of code
<phoe> so I don't think you can avoid duplicating code if you *need* duplicating code
<VincentVega> phoe: I see. I think I could with a macro, though.
<phoe> you can only try to hide it behind some sort of macrology, but adding conditionals like that would likely require code walking in order to find the conditionals in the code
<phoe> like, if a hypothetical FLAG-LAMBDA like (flag-lambda (x y z) ...) expands into conditionals based on X, Y and Z, then (flag-lambda (x y z) (... (... (flag-when x ...))))
<phoe> this requires code walking so FLAG-LAMBDA can recognize how to skip or not skip the inner FLAG-WHEN invocation
<phoe> doable, but nontrivial
<VincentVega> phoe: Hmm, I see what you are saying, that makes sense. But to avoid code walking, I could write a seperate macro too, so that's cool. Well, thanks for explaining this!
<phoe> ....hmmmm
<phoe> you know
<phoe> maybe you could use the symbol-macrolet trick to avoid code walking
<Nilby> I don't think you need walking if you don't care that there's two versions of the lambda
<phoe> Nilby: I mean, one of these lambdas needs to have the PRINT call and the other needs to not have it
<Nilby> that's what I'm thinking
s-liao22 has quit [Ping timeout: 256 seconds]
<phoe> so something like (flag-lambda (x) (flag-when x (print "foo")) (+ 1 2)) expands into (if x (lambda () (print ...) ...) (lambda () ...))
<phoe> at least that is my idea
<phoe> and I just realized that you can avoid code walking - you can pass information in &environment
<phoe> and it will cause FLAG-WHEN to expand into either (progn) for nothing or (progn ...) - depending on whether a given flag is meant to be set for the given generated lambda
<phoe> I have no idea if I explain myself clearly here
s-liao has joined #commonlisp
<phoe> VincentVega: I can sketch out a solution later today if you're interested and/or don't know how to start
<phoe> ;; also, uh, hi everyone, sorry for being effectively MIA for the past few months
<VincentVega> phoe: I think I know what you are saying, I am playing around with code rn to see what works best : )
<phoe> <3
<VincentVega> welcome back btw
<phoe> thanks
waleee has quit [Ping timeout: 264 seconds]
esb has quit [Ping timeout: 252 seconds]
<Nilby> something like https://plaster.tymoon.eu/view/2736#2736 maybe?
<Nilby> but it doesn't seem to disassemble the lambda how I expect
winning-luser has joined #commonlisp
theothornhill has joined #commonlisp
<phoe> as in?\
<phoe> (+ 1 2) will likely be constant-folded, that's for sure
<VincentVega> Nilby: My simplest version is this for now https://pastebin.com/yWe3Vbx5
<Nilby> phoe: oh right, that makes sense
<VincentVega> I mean, the other way is to do this generally like phoe suggested. For multiple variables, that is, would be useful. Maybe I will even make it.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
Krystof has joined #commonlisp
kevingal has quit [Remote host closed the connection]
<VincentVega> phoe: Nilby: OK, it's actually quite nifty with a symbol-macrolet https://pastebin.com/WN3NU68j except for the deleting unreachable code warnings.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
<phoe> you can avoid unreachable code if you create your own FLAG-WHEN instead
<phoe> that's not yet the symbol-macrolet trick that I was thinking of
<phoe> give me a few hours to finish work and then I'll be able to show you if no one does before me :D
<VincentVega> phoe: cool thanks! i just hope i ain't a bother
<Nilby> Nice. Nearly zero run cost conditional logging. Probably less code bloat than C++ templates. I'm curious to see phoe's extra fancy way.
pranavats has joined #commonlisp
<phoe> VincentVega: nah, I'll enjoy a chance to properly exercise my lisp muscles again
<VincentVega> Nilby: yep, with a custom when-flag, the warnings are gone, will be curious to see another way too : )
<VincentVega> phoe: ok : )
attila_lendvai has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
theothornhill has quit [Ping timeout: 252 seconds]
theothornhill has joined #commonlisp
waleee has joined #commonlisp
random-nick has joined #commonlisp
edgar-rft has quit [Quit: Leaving]
cosimone has quit [Ping timeout: 268 seconds]
jeosol has joined #commonlisp
tyson2 has joined #commonlisp
johnjay has quit [Ping timeout: 250 seconds]
s-liao has joined #commonlisp
johnjay has joined #commonlisp
theothornhill has quit [Ping timeout: 264 seconds]
esb has joined #commonlisp
thmprover has quit [Remote host closed the connection]
<phoe> VincentVega: got it
<phoe> I use &environment to communicate between the outer macro(s) FLAG-LAMBDA and the inner macro(s) FLAG-WHEN
<phoe> SYMBOL-MACROLET is a way of writing stuff into the compilation environment and MACROEXPAND-1 with a symbol is a way of reading it
<phoe> you can use MACROLET as well, just more parens this way
<phoe> in the fully macroexpanded code, you can ignore L29 completely - it's just noise leftover by the communication
<phoe> what matters is the fact that the (IF X (LAMBDA ...) (LAMBDA ...)) structure is what you seem to want, and a total of 2^n functions will be generated based on the combination of flags
<phoe> note that this is untested PoC code, still likely buggy; test before use
<phoe> a tidbit is my use of LOCALLY instead of PROGN to permit declarations, since you have a lot of #.*burn-baby-burn* style of declarations
kingofcsu has joined #commonlisp
cosimone has joined #commonlisp
<Nilby> Nice a succinct showcase for these cool macroolgy techniques!
Bike has joined #commonlisp
waleee has quit [Ping timeout: 264 seconds]
waleee has joined #commonlisp
<Nilby> Mutually and manually macro expanding, moreover meticulously mind expanding.
lisp123 has joined #commonlisp
waleee has quit [Ping timeout: 256 seconds]
lisp123 has quit [Ping timeout: 256 seconds]
Lycurgus has joined #commonlisp
pdietz has joined #commonlisp
waleee has joined #commonlisp
thomaslewis has quit [Ping timeout: 256 seconds]
thomaslewis has joined #commonlisp
_73 has left #commonlisp [ERC (IRC client for Emacs 27.2)]
s-liao has quit [Quit: Client closed]
s-liao has joined #commonlisp
<phoe> there's actually two layers of macros in there
<phoe> one being the "real" macros that are expanded into Lisp code
<phoe> and the other being symbol macros whose only purpose is to exist in &env as a way of passing information deeper into the macroexpansion process
waleee has quit [Ping timeout: 252 seconds]
<hobo> we've got to go deeper
<VincentVega> phoe: Awesome, thank you! This is sure finer than a single symbol-macrolet.
<phoe> but not in this way, there is only one compilation environment
<phoe> VincentVega: no problem, hope it's useful
LoopMacro has joined #commonlisp
s-liao has quit [Quit: Client closed]
<phoe> VincentVega: in your previous example, you could substitute SYMBOL-MACROLET for LET and it would still work
<phoe> ;; just, well, with closures, just like before
<phoe> in your previous example, you had (when x ...) turn into (when t ...) or (when nil ...) which generated unreachable code warnings
<phoe> now the macro simply doesn't generate any code for the cases that could previously generate something like (when nil ...)
waleee has joined #commonlisp
<VincentVega> phoe: hmm, yes, i see, nice!
edgar-rft has joined #commonlisp
Algernon666 has joined #commonlisp
lisp123 has joined #commonlisp
kingofcsu has quit [Remote host closed the connection]
nature has joined #commonlisp
Algernon91 has quit [Ping timeout: 252 seconds]
taiju has quit [Read error: Connection reset by peer]
taiju has joined #commonlisp
<VincentVega> phoe: I take it you wouldn't mind if I use this stuff in my code (under lgpl) quoting you as the author?
igemnace has joined #commonlisp
xsperry has quit [Killed (NickServ (GHOST command used by ahahaha!~xs@cpe-188-129-101-182.dynamic.amis.hr))]
xsperry has joined #commonlisp
antoszka has joined #commonlisp
x88x88x has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
kevingal has joined #commonlisp
Cymew has quit [Ping timeout: 252 seconds]
frgo has joined #commonlisp
waleee has quit [Ping timeout: 268 seconds]
waleee has joined #commonlisp
tyson2 has joined #commonlisp
ec_ has joined #commonlisp
edgar-rft has quit [Quit: Leaving]
<phoe> VincentVega: take it under whatever license you'd like under only one condition
<phoe> you will write extensive unit tests for it to ensure that it works correctly
<phoe> credit is nice but optional, working code is much more desirable :D
<phoe> (oh, and don't export the %TRUE-FLAGS% symbol - it's important that users don't have the ability to shadow it in any way)
<VincentVega> phoe: Understood, will do. Thanks again!
mfiano has quit [Ping timeout: 268 seconds]
<Guest746> phoe: very nice. Never seen an example of using &env.
lisp123 has quit [Remote host closed the connection]
<phoe> Guest746: it's one of the basic uses - ensuring that MACROEXPAND-1 can expand locally defined macros
<phoe> otherwise your macros that need to expand other macros will break when MACROLET and SYMBOL-MACROLET come into play
<Guest746> yeah i haven't run into any nested macro opportunities yet. I suspect it's in the future for my binary reader/writer so i'll try and keep this stuff in mind.
danieli6 has joined #commonlisp
hineios4 has joined #commonlisp
Odin-FOO has joined #commonlisp
Odin- has quit [Ping timeout: 256 seconds]
okflo has quit [Ping timeout: 256 seconds]
dtman34 has quit [Ping timeout: 256 seconds]
Patternmaster has quit [Ping timeout: 256 seconds]
FragmentedCurve has quit [Ping timeout: 256 seconds]
dtman34_ has joined #commonlisp
<phantomics> How's it going, phoe? Been a while
x88x88x has quit [Ping timeout: 256 seconds]
danieli has quit [Ping timeout: 256 seconds]
danieli6 is now known as danieli
markasoftware has quit [Ping timeout: 256 seconds]
perrierjouet has quit [Ping timeout: 256 seconds]
hineios has quit [Ping timeout: 256 seconds]
hineios4 is now known as hineios
markasoftware has joined #commonlisp
Patternmaster has joined #commonlisp
FragmentedCurve has joined #commonlisp
dtman34 has joined #commonlisp
voltron has joined #commonlisp
<phoe> phantomics: basically took a small sabbatical from everything programming-related
dtman34_ has quit [Ping timeout: 256 seconds]
okflo has joined #commonlisp
voltron has quit [Remote host closed the connection]
voltron has joined #commonlisp
<phantomics> Can help to take a breather sometimes
<phantomics> April has progressed a lot, I'm checking off the final todos before a new release, been testing it with all different CLs
aartaka has quit [Ping timeout: 256 seconds]
<phantomics> I just discovered that Allegro CL apparently doesn't know what "alphanumeric" means - try (alphanumericp #\←) and observe the results
<jackdaniel> well, it is almost December, that makes it approximately April 270 :)
aartaka has joined #commonlisp
<phantomics> And then try (acosh -2) and get a divide by 0 error
<phantomics> It seems that in Allegro, (alphanumericp) gives nil for the common keyboard symbols that aren't alphanumeric like +, / and @ but many other unicode characters not on the keyboard will return T
voltron has quit [Remote host closed the connection]
makomo has joined #commonlisp
perrierjouet has joined #commonlisp
voltron has joined #commonlisp
voltron has quit [Remote host closed the connection]
<phoe> phantomics: amazing to hear it about April
<phoe> and weird to hear it about Allegro :D
<phantomics> You can find the matching characters in an implementation with (loop :for i :below (expt 2 16) :when (and (code-char i) (alphanumericp (code-char i))) :do (princ (code-char i)))
<phantomics> It turns out that in CCL, all Chinese/Japanese kanji register as alphanumeric
<phantomics> Meanwhile in Allegro, all sorts of weird stuff matches, beware though as it may crash your Emacs
kevingal has quit [Remote host closed the connection]
Lycurgus has quit [Ping timeout: 264 seconds]
Oladon has joined #commonlisp
cage has joined #commonlisp
bremner has joined #commonlisp
prxq has joined #commonlisp
Algernon69 has joined #commonlisp
Algernon666 has quit [Quit: Leaving]
<Guest746> is there any portable way to access ftype declarations?
<phoe> Guest746: you mean declarations or proclamations?
<phoe> hm, I guess that (ql:quickload :introspect-environment) should work for both
tyson2 has quit [Remote host closed the connection]
<phoe> and then call FUNCTION-INFORMATION with the function name plus a lexenv if you have it
<Guest746> that seems to work. is this sbcl only? or m-. is leading me astray here.
yewscion has joined #commonlisp
<CodeBitCookie[m]> Hello everyone,
<CodeBitCookie[m]> so I want to send keyboard and mouse input automatically with Common Lisp. Is there any way you suggest that I go about this?
<CodeBitCookie[m]> I did read a few outdated blogs.
<CodeBitCookie[m]> I would prefer if there were a cross platform solution but if the library depends on Xorg or Windows only stuff then that's fine too.
mfiano has joined #commonlisp
<jackdaniel> Guest746: cltl2 defines the environment access api that contains necessary information
<jackdaniel> this information was dropped in the final ansi standard, but some implementations still implement it
<jackdaniel> s/this information was dropped/this api was dropped/
<Guest746> so no trivial-cltl2? I'm not sure it's a big deal since I can't find local-sockets anywhere besides the same ones.
<Guest746> this is for a probably bad idea to autogenerate dbus interfaces if ftypes are declared.
ns12 has quit [Quit: bye]
ns12 has joined #commonlisp
<Bike> trivial-cltl2 exists. there's also uhhhhh introspect-environment, which i wrote.
<Bike> not sure what this has to do with sockets though.
<Guest746> well it doesn't help to generate a dbus interface if you don't have a socket to communicate with :)
Odin-FOO is now known as Odin-
<Bike> isn't there a dbus library that can automatically generate an api from the dbus introspection stuff?
<yitzi> death wrote one I believe.
<Bike> i poked at it once... yeah, death's
<Guest746> anybody know the name?
<Guest746> the onlything i found on cliki was cl-dbus
<yitzi> Its in quicklisp, btw.
<Guest746> well, i'll have to look at that. thanks. Though it seems to generate from introspected stuff, which is the other half. I'm thinking about the part of generating from lisp functions.
<Guest746> ugh, requires iolib.
amb007 has quit [Ping timeout: 264 seconds]
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
<hobo> all aboard the death dbus
<hobo> make sure you let the people care about know you're leaving
poselyqualityles has joined #commonlisp
Bike42 has joined #commonlisp
Bike42 is now known as Bicyclidine
waleee has quit [Quit: WeeChat 3.3]
tyson2 has joined #commonlisp
waleee has joined #commonlisp
<Guest746> anybody else have problems loading cxml?
<jcowan> fwiw, Interlisp has two structure editors built-in, one TTY and one GUI; most Interlisp programming is done in the GUI (one function at a time, as in Smalltalk)
Bike has quit [Ping timeout: 264 seconds]
rotateq has joined #commonlisp
Catie has joined #commonlisp
edgar-rft has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
gxt has quit [Remote host closed the connection]
gxt has joined #commonlisp
varjag has joined #commonlisp
poselyqualityles has quit [Ping timeout: 256 seconds]
Alfr is now known as Guest1819
Alfr has joined #commonlisp
Guest1819 has quit [Ping timeout: 265 seconds]
Algernon69 has quit [Ping timeout: 245 seconds]
theothornhill has joined #commonlisp
Algernon69 has joined #commonlisp
Algernon69 has quit [Ping timeout: 250 seconds]
MetaYan_ is now known as MetaYan
waleee has quit [Ping timeout: 268 seconds]
waleee has joined #commonlisp
Algernon69 has joined #commonlisp
Guest746 has quit [Quit: Connection closed]
_73 has joined #commonlisp
Inline has joined #commonlisp
rain3 has quit [Ping timeout: 264 seconds]
Bicyclidine has quit [Quit: Connection closed]
Algernon69 has quit [Ping timeout: 252 seconds]
voltron has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 27.1]
voltron has quit [Remote host closed the connection]
Oladon has quit [Quit: Leaving.]
_73 has left #commonlisp [ERC (IRC client for Emacs 27.2)]
paul0 has quit [Remote host closed the connection]
Oladon has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
Bike has joined #commonlisp
aartaka has quit [Ping timeout: 252 seconds]
<theothornhill> I didn't find any frameworks for using GraphQL in common lisp, so I made one. It isn't done yet, but it works. It follows the spec closely, and aims to be fully compliant when I'm done. However, I'd love to get feedback so that I can improve things before the apis settle too hard. So, shamefully posting it here. Sorry if it is the wrong forum :)
mrcom has quit [Quit: Leaving]
<theothornhill> There's also some crude docs here, if you're interested: https://man.sr.ht/~theo/gql/
<stylewarning> (In case you didn't see on Twitter or Reddit:) I wanted to invite Lisp IRC to a small Advent of Code contest to use Coalton (a DSL in CL) with a variety of prize categories. Check it out :) https://coalton-lang.github.io/20211129-aoc-contest/
<jasom> stylewarning: if my ML knowledge is "I did one OcaML tutorial 20 years ago" what's the time to be able to actually do stuff in Coalton?
attila_lendvai has quit [Ping timeout: 264 seconds]
<rotateq> would be very interesting for me like coalton on its own, but i just have Haskell and not ML experience beside the main stuff :)
<rotateq> oh cool, you built a parser combinator for quil with it
aartaka has joined #commonlisp
gxt has quit [Ping timeout: 276 seconds]
gxt has joined #commonlisp
aartaka has quit [Ping timeout: 252 seconds]
gaqwas has joined #commonlisp
<stylewarning> jasom: Probably within an hour, especially if you grok type classes OK (which are like an 'interface', 'protocol', or 'trait')
<stylewarning> rotateq: Coalton's type system is like Haskell's, not ML's
<stylewarning> So, type classes, instances, (optionally: monads), all that
<rotateq> okay right i remember when i read a bit about it last year
<stylewarning> rotateq: Yeah it changed a lot since that time. You might be interested in reading https://coalton-lang.github.io/20211010-introducing-coalton/
<rotateq> I now stumbled again over Quil too :)
<rotateq> and thank you
mrcom has joined #commonlisp
<stylewarning> jasom: I might be underestimating you, an hour is maybe too much. Knowing all the other stuff you've done, reading this is probably 10 minutes or less :) https://github.com/coalton-lang/coalton/blob/main/docs/intro-to-coalton.md
nature has quit [Ping timeout: 264 seconds]
yewscion has quit [Quit: Connection closed]
Oladon has quit [Quit: Leaving.]
tyson2 has joined #commonlisp
varjag has quit [Ping timeout: 264 seconds]
Catie has quit [Remote host closed the connection]
Inline has quit [Quit: Leaving]
Catie has joined #commonlisp
pve has quit [Quit: leaving]
<Xach> problems in my .hu-niverse
danirukun has joined #commonlisp
danirukun has quit [Quit: ERC (IRC client for Emacs 29.0.50)]
dre has joined #commonlisp
danirukun has joined #commonlisp
danirukun has left #commonlisp [#commonlisp]
Algernon69 has joined #commonlisp
varjag has joined #commonlisp
shka has quit [Ping timeout: 256 seconds]
theothornhill has quit [Remote host closed the connection]
varjag has quit [Ping timeout: 256 seconds]
dra has joined #commonlisp
dre has quit [Remote host closed the connection]
dre has joined #commonlisp
Guest74 has joined #commonlisp
Algernon69 has quit [Ping timeout: 245 seconds]
<Guest74> yeesh, i can't even complete all 25 in CL.
<dre> all 25 what?
theothornhill has joined #commonlisp
theothornhill has quit [Remote host closed the connection]
random-nick has quit [Read error: Connection reset by peer]
yewscion has joined #commonlisp
<Guest74> AoC
<rotateq> and how do you know that now?
mfiano has quit [Ping timeout: 256 seconds]
<dre> yeah nice
<dre> I'm looking to do AoC with common lisp
<dre> I know practically nothing about common lisp, wish me luck guys :)
<rotateq> dre: if you have a question right now, go on :) no guarantuee i can answer it fully
<dre> :p nah not at the moment
<rotateq> how long now since you started this wonderful journey?
dra has quit [Remote host closed the connection]
<dre> maybe a month in earnest. but progress is slow after a long day of procedural programming work
<dre> following through land of lisp and practical common lisp books
<dre> rotateq, just then I tried this without doing any googling, am I doing it right? https://dpaste.org/uDve
<rotateq> PCL is a good start :)
<dre> also sorry about indents. I'm using vim as my editor and we all know what a bad idea that is
<rotateq> there is also slime for vim
<rotateq> but me and some other people use spacemacs, it comes with the editor part as vim-like
<dre> I'm using vim-slime. it's by far the best solution I've come across ( using tmux /sbcl as the repl
<dre> I've tried it and it just doesn't quite feel the same. I do keep thinking that I might one day make the change to emacs, but.. i dunno when. time investments and all that.
<rotateq> those things pay back in the long run
<dre> mm. I suppose you're right
<rotateq> hmm, this nested mapc
<Guest74> anybody have an AoC utils they use? I thought I had a bunch but looks like I just got stuff to load and parse the inputs.
hisacro has quit [Ping timeout: 268 seconds]
<Bike> this is a bit inefficient, since it will redo sums that didn't work. you could do (block nil (mapl (lambda (ls) (let ((item (first ls))) (mapc (lambda (x) (when (= (+ item x) 2020) (return (* item x)))) (rest ls))))))))))))))
<Bike> not that it matters with this small a list, but maybe it's supposed to be scaled up
hisacro has joined #commonlisp
gaqwas has quit [Ping timeout: 256 seconds]
cosimone has quit [Ping timeout: 264 seconds]
theothornhill has joined #commonlisp
<Xach> which ones will it redo?
theothornhill has quit [Ping timeout: 252 seconds]
waleee has quit [Ping timeout: 268 seconds]
waleee has joined #commonlisp
s-liao has joined #commonlisp