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/>
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ebrasca> Is there a way to tell GC to delete elements from a hash table when nothing point to the element from outside?
<mathrick> ebrasca: yes, but it's implementation-specific and you want to use a wrapper
<mathrick> it's called weak hash tables
gxt has quit [Ping timeout: 258 seconds]
<ebrasca> When do the GC delete things from them?
<mathrick> whenever it gets around to it. There are no guarantees that GC will run at any particular time, or ever for that matter
<mathrick> it depends on the GC being used
<ebrasca> What about sbcl?
<Bike> it depends on what kind of weakness
<Bike> all implementations pretty much support basic weak hash tables, so you shouldn't need to worry about specificity there too much
<Bike> for a weak-key hash table, the pair (i.e. the key and value) may be deleted if the key is no longer reachable from outside the table. ditto weak-value and the value
<Bike> and then there's also key-or-value and key-and-value.
<ebrasca> Is there some other data structure like this?
<Bike> there are weak pointers
<ebrasca> Is there a weak list?
gxt has joined #commonlisp
<Bike> you can make a list of weak pointers, which is pretty close.
<ebrasca> It says they cost more , is it worth to use them?
<Bike> depends on your application
<jcowan> Bike: Typically a weak-key hashtable only releases an association if the key is not reachable except from the table; in particular, if it is reachable from the value, you need an ephemeron.
comatory has quit [Ping timeout: 244 seconds]
<mathrick> ebrasca: SBCL has a bunch of GC's actually. None of them guarantee anything about when things will be cleaned up to my knowledge. You should not rely on GC to free resources for you if it's critical that they be freed, it's neither portable nor reasonable to expect of any commonly used implementations because their GCs are not deterministic
<jcowan> Indeed, there is no guarantee that the GC runs at all.
<mathrick> refcounting is the only GC scheme which has a reasonable expectation of determinism, but refcounting is not used in any serious CL implementation
<jcowan> No. And it is only deterministic in principle, not in practice.
<mathrick> that's why "reasonable expectation" :)
<hayley> For what definition of "determinism"?
<ebrasca> I only care it will run before I run out of memory and not consume to much CPU time!
<mathrick> hayley: that cleanup will happen soon after things become inaccessible
<hayley> And it is best to be precise; only refcounting implementations which update reference counts eagerly, and don't defer or coalesce, will reclaim memory (not involved in a cycle) "immediately".
<mathrick> ebrasca: in that case just making them weak is all you need, it's no different from any other inaccessible object at that point
<hayley> Speaking of, I still need to figure out how weak references might work with coalesced RC.
<mathrick> hayley: correct. I wasn't trying to be as precise as possible, because again, refcounting is not used in practical CL implementations so it's not super important to get it 100% accurate
<ebrasca> Can I add some fuction to run when it is garbage collected ? ( Like delete the asociated image file )
nij- has joined #commonlisp
comatory has joined #commonlisp
<mathrick> again, implementation-specific, you'll want to use a wrapper
<mathrick> that same section also talks about weak pointers
<ebrasca> Good to know
<mathrick> trivial-garbage wraps all of those things, so it'll work fine on SBCL
Oladon has quit [Quit: Leaving.]
eddof13 has joined #commonlisp
gxt has quit [Remote host closed the connection]
<ebrasca> Thanks!
masinter has quit [Ping timeout: 252 seconds]
masinter has joined #commonlisp
gxt has joined #commonlisp
waleee has quit [Ping timeout: 264 seconds]
jmdaemon has quit [Ping timeout: 252 seconds]
P1RATEZ has quit [Remote host closed the connection]
ebrasca has quit [Remote host closed the connection]
masinter has quit [Ping timeout: 244 seconds]
masinter has joined #commonlisp
paulapatience has joined #commonlisp
dre has quit [Quit: Leaving]
jmdaemon has joined #commonlisp
azimut_ has quit [Ping timeout: 258 seconds]
<mathrick> why is SBCL + ASDF loading my fasls twice when loading the system? I have a DEFINE-FOO macro which expands to a (defclass my-foo () ...) + (register-foo my-foo), and there's exactly one (define-foo my-foo) in a single file, but (register-foo my-foo) is getting called twice
<mathrick> when I inserted BREAK into REGISTER-FOO, I can see that the fasls are loaded twice
<mathrick> which I don't understand
cowboy has joined #commonlisp
<mathrick> CCL does the same, so I guess it's an ASDF thing?
<cowboy> Im pretty new to lisp. What interpeter is best?
<mathrick> first of all, "implementation" and not "interpreter". Almost no CL implementations out there are pure interpreters, most have sophisticated compilers
<mathrick> second of all, depends on what you want to do
<mathrick> SBCL is a safe default
<mathrick> CCL might be nice if you're on a Mac, but SBCL works on Macs too
<mathrick> there are other implementations that might be better suited for your particular needs
<cowboy> why implementation?
<aeth> cowboy: people say "implementation" because it could be an interpreter or a compiler; it's usually a compiler, but it's not guaranteed
<mathrick> cowboy: "Almost no CL implementations out there are pure interpreters, most have sophisticated compilers"
<cowboy> had no clue. Thanks! Smarter every day! LOL
<aeth> (deftype implementation () `(or interpreter compiler))
<mathrick> if you say "interpreter", it's both inaccurate and could be confusing when you're talking to people who understand CL well, because it makes it sound like you're specifically interested in the interpreter component of the implementation
<aeth> People tend to use SBCL because it tends to both be the fastest and the one with the most useful error messages.
<aeth> Quite the combination to offer both.
<aeth> This is, of course, information that can go out of date.
<cowboy> ok cool. Thats the one i have at the moment.
<cowboy> CL is ever differnt. Makes it pretty fun to learn.
<mathrick> yup!
<Alfr> aeth, which would the following be? Create all possible states and then destroy all those which do not conform to language semantics?
White_Flame has quit [Remote host closed the connection]
<cowboy> what client are yall using?
White_Flame has joined #commonlisp
<mathrick> what I also don't understand about the double-FASL-load problem is that I put in a safeguard in the macro expansion for exactly that situation, but even though REGISTER-FOO is run on the first load, the safeguard on the second load is rendered ineffective so it still calls REGISTER-FOO
<mathrick> I don't think I understand how the expansion proceeds
<saturn2> mathrick: are you possibly calling REGISTER-FOO at both compile time and load time?
<mathrick> saturn2: I don't know actually. What's the default in the absence of EVAL-WHEN?
tyson2 has joined #commonlisp
<mathrick> my macro is something along the lines of (defmacro define-foo (name) (unless (lookup-foo name) `(progn (define-class ,name ()) (register-foo ',name)))
cowboy has quit [Quit: WeeChat 3.5]
cowboy has joined #commonlisp
<saturn2> should just be load time then
<mathrick> s/define-class/defclass/
<saturn2> the lookup-foo will happen whenever the macro is expanded though, which is likely to cause confusion, but probably wouldn't cause register-foo to be called twice
<mathrick> it also doesn't error out when I just C-c C-c in SLY/SLIME
<mathrick> saturn2: what kind of confusion?
<mathrick> I think the notes in http://www.lispworks.com/documentation/HyperSpec/Body/s_eval_w.htm might be a clue for me
<mathrick> but then, the expander doesn't do side effects
<saturn2> the return value from lookup-foo would reflect the state of the compilation environment, not the environment when it is loaded
<saturn2> so you could compile it in an image where lookup-foo returns true, and load it in one where it would return false, or vice versa, and your class would end up being redefined or not defined at all
<mathrick> hmm
<mathrick> I guess I should put the call to REGISTER-FOO in a safeguarded block then and just let the definitions happen when they do
<saturn2> i would suggest making register-foo idempotent if possible
cowboy has quit [Quit: WeeChat 3.5]
cowboy has joined #commonlisp
<mathrick> yeah, it's a part that I don't really know the design of yet, because it's supposed to be a registry of "available" code modules, where "available" depends both on what code was compiled and what the runtime environment is
cowboy has quit [Client Quit]
<mathrick> it'll definitely require a lot more careful thinking about
cowboy has joined #commonlisp
Oladon has joined #commonlisp
jolby has quit [Quit: Client closed]
<mathrick> OK, now I'm completely baffled. I changed the macro to wrap REGISTER-FOO in a safeguard block, and it's still getting called twice
<mathrick> ...and now it loads, even though I tried clearing ASDF config and retrying. I guess "try recompiling" is not included in "clear configuration and retry"?
thuna` has quit [Remote host closed the connection]
<saturn2> no, that will only search for new or updated .asd files
<mathrick> oh
akoana has quit [Quit: leaving]
paulapatience has quit [Ping timeout: 244 seconds]
jolby has joined #commonlisp
cowboy has quit [Quit: #lua]
cowboy has joined #commonlisp
cowboy has quit [Client Quit]
cowboy8625 has joined #commonlisp
Brucio-61 has quit [Ping timeout: 260 seconds]
antonv has joined #commonlisp
<antonv> Domain certificate expired for https://ccl.clozure.com/
livoreno has joined #commonlisp
mrcom has joined #commonlisp
igemnace has joined #commonlisp
jolby has quit [Quit: Client closed]
tasty has quit [Ping timeout: 252 seconds]
tasty has joined #commonlisp
tasty has quit [Changing host]
tasty has joined #commonlisp
bitmapper has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jmdaemon has quit [Quit: ZNC 1.8.2 - https://znc.in]
Oladon has quit [Quit: Leaving.]
jmdaemon has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
comatory has quit [Ping timeout: 260 seconds]
comatory has joined #commonlisp
cercopith has quit [Remote host closed the connection]
cercopith has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
SR-71 has joined #commonlisp
eddof13 has joined #commonlisp
slyrus has joined #commonlisp
eddof13 has quit [Client Quit]
antonv has quit [Ping timeout: 268 seconds]
SR-71 has quit [Remote host closed the connection]
cercopith_ has joined #commonlisp
cercopith has quit [Ping timeout: 244 seconds]
comatory has quit [Ping timeout: 244 seconds]
comatory has joined #commonlisp
Brucio-61 has joined #commonlisp
comatory has quit [Ping timeout: 268 seconds]
nij- has left #commonlisp [Using Circe, the loveliest of all IRC clients]
shka has joined #commonlisp
<paule32_> hello, and good morning
paule32_ is now known as paule32
<paule32> i would use a locales package, to localize my script
<paule32> i have re-design my last script a little bit, so that it is working, now
<paule32> you can take a look at it there: https://dpaste.com/8XZWVT7EC
<paule32> in the same script, i use the locale package, from a github account
<paule32> i have made comments on the upper part of the script
<paule32> the problematic lines in the moment are lines: 63, and 64
Cymew has joined #commonlisp
comatory has joined #commonlisp
pve has joined #commonlisp
frgo_ has joined #commonlisp
frgo has quit [Ping timeout: 260 seconds]
frgo_ has quit [Ping timeout: 260 seconds]
jeosol has quit [Ping timeout: 252 seconds]
thuna` has joined #commonlisp
ttree has quit [Ping timeout: 260 seconds]
frgo has joined #commonlisp
comatory has quit [Ping timeout: 252 seconds]
cosimone has joined #commonlisp
comatory has joined #commonlisp
pranavats has joined #commonlisp
m5zs7k has quit [Ping timeout: 268 seconds]
m5zs7k has joined #commonlisp
mjoerg has joined #commonlisp
mjoerg has quit [Remote host closed the connection]
makomo has joined #commonlisp
dre has joined #commonlisp
comatory_ has joined #commonlisp
comatory has quit [Ping timeout: 268 seconds]
comatory has joined #commonlisp
comatory_ has quit [Read error: Connection reset by peer]
jolby has joined #commonlisp
jolby has quit [Client Quit]
scymtym has quit [Ping timeout: 244 seconds]
Brucio-61 has quit [Ping timeout: 268 seconds]
Noisytoot has quit [Quit: ZNC 1.8.2 - https://znc.in]
Noisytoot has joined #commonlisp
thuna` has quit [Remote host closed the connection]
<pve> Hi, does anyone know if there's an algorithm (and hopefully implementation) that "unifies" two strings into the most specific regular expression that matches both strings? So for the strings "Richard Phillips Feynman (1918-1988)" and "Enrico Fermi (1901-1954)", I would expect to get back something like "^.*(19.*-19.*).*$".
<jackdaniel> there is a machine learning thing, but I'm not sure how far it will get you
<jackdaniel> other than that, the most specific regexp will be OR between both strings verbatim
<pve> ah yes, of course
<jackdaniel> i.e 1918 vs 1901 could be unified as 19[10][81]
<jackdaniel> alternatively, a more lax algorithm would be .*
<pve> i was thinking of searching for a solution by "lining up" the characters that occur in both strings, and placing .* between them
<jackdaniel> and what is the criteria for lining up the characters?
<jackdaniel> say that both strings have a letter "a" in names, do we line with this "a"? or we treat specially ( and ) ?
<jackdaniel> if you want to treat things specially to fill some specific pattern, then you are looking for a pattern matcher (i.e trivia)
<hayley> There is "anti-unification" for logic terms.
<pve> I would search the space of possible matches and try to maximise the number of letters that line up, while still being "in order"
<pve> sorry, I'm not explaining it very well :)
<pve> but I'm not sure that would work
<jackdaniel> so if you have names "Albert Einstein (19xx-19xx)" and "Albert Zweistein (19xx-19xx)" what will you do?
<jackdaniel> I think that what you want to achieve is closer to "intuitively good regexp matching strings" vs some "well defined regexp based on strings", that's why I've suggested that machine learning will get you something closer to what you expect
<jackdaniel> given that you have a training data of course
<pve> I think I'd want "Albert .*stein (19xx-19xx)"
<edgar-rft> I'd use "Albert [12]stein"
Brucio-61 has joined #commonlisp
<pve> Yeah, I'd like to avoind machine learning for the time being. The problem at hand isn't so critical that it can't be done manually.
<jackdaniel> pve: and why not "Albert .?ei.?stein (19xx-19xx)"?
scymtym has joined #commonlisp
<jackdaniel> .?.?ei.? *
<jackdaniel> this gets more cryptic with each iteration! :)
<pve> that works too, it's ok to be presented with more than one solution
<jackdaniel> pve: the thing is that a number of "possible" solutions is quite big, and most of these solutions would not be very readable
<jackdaniel> one very readable solution is ".*"
<jackdaniel> or "${common-prefix}.*${common-suffix}"
<jackdaniel> but doing better than that may prove to be quite unfeasible in general case (i.e without a well defined pattern)
<pve> i think .* would be discarded if some letters line up
<pve> and otherwise, the solutions could probably be order somehow, e.g. by string length
<pve> ordered
<pve> but yeah, I hear you about unfeasibility in the general case
<jackdaniel> I think that your problem is not well defined (and I don't have more input than what I've said above)
<pve> I will think about this some more, and try to define it better.
azimut has joined #commonlisp
comatory has quit [Ping timeout: 244 seconds]
<_death> pve: in bioinformatics, there are many variants of edit distance alignment
<_death> algorithms
<pve> _death: hmm, didn't think of this in terms of edit distance
<_death> the "ordinary" one could result in something like (edit-distance-align "Richard Phillips Feynman (1918-1988)" "Enrico Fermi (1901-1954)") ==> 22, "Richard Phillips Feynman (19-18-1988)", "En---r----ico--- Fer-mi- (1901--1954)"
<pve> yes! that looks promising
comatory has joined #commonlisp
<_death> if you do the rosalind challenges (without using libraries) you'd have to implement several variants (including aligning more than two strings)
<pve> _death: thank you, bookmarked
<pve> at least intuitively, it seems I could add filler characters to the shorter string, and then move them around to minimize the hamming distance..
<_death> hamming distance is about bitstrings :)
<pve> (they mention hamming distance)
<_death> yeah, I guess I had a more specific definition for it than warranted
<pve> this is pretty cool, I'm going to try this
makomo has quit [Ping timeout: 244 seconds]
makomo_ has quit [Ping timeout: 260 seconds]
random-nick has joined #commonlisp
<_death> note that the problem references earlier problems that make you implement a procedure to compute the edit distance
<_death> there you may learn about dynamic programming, and with this problem figure out how to modify what you implemented for the alignment problem.. the algorithm is called needleman-wunsch
<pve> got it
azimut has quit [Ping timeout: 258 seconds]
livoreno has quit [Ping timeout: 244 seconds]
gxt has quit [Remote host closed the connection]
gxt has joined #commonlisp
gxt has quit [Remote host closed the connection]
comatory has quit [Ping timeout: 248 seconds]
comatory has joined #commonlisp
gxt has joined #commonlisp
aartaka has joined #commonlisp
comatory has quit [Ping timeout: 244 seconds]
aartaka has quit [Ping timeout: 268 seconds]
aartaka has joined #commonlisp
aartaka has quit [Read error: Connection reset by peer]
aartaka has joined #commonlisp
SR-71 has joined #commonlisp
comatory has joined #commonlisp
makomo_ has joined #commonlisp
pranavats has left #commonlisp [#commonlisp]
SR-71 has quit [Ping timeout: 244 seconds]
pranavats has joined #commonlisp
aartaka has quit [Read error: Connection reset by peer]
aartaka has joined #commonlisp
frgo has quit [Remote host closed the connection]
dlowe has quit [Remote host closed the connection]
pranavats has left #commonlisp [Error from remote client]
Posterdati has quit [Remote host closed the connection]
tyson2 has joined #commonlisp
nij- has joined #commonlisp
nij- has quit [Client Quit]
nij- has joined #commonlisp
pranavats has joined #commonlisp
gxt has quit [Remote host closed the connection]
gxt has joined #commonlisp
jmdaemon has quit [Ping timeout: 244 seconds]
pjb has joined #commonlisp
Posterdati has joined #commonlisp
bitmapper has quit [Quit: Connection closed for inactivity]
glaucon has joined #commonlisp
gxt has quit [Remote host closed the connection]
gxt has joined #commonlisp
eddof13 has joined #commonlisp
Josh_2 has quit [Ping timeout: 260 seconds]
thuna` has joined #commonlisp
<paule32> hello
pjb has quit [Remote host closed the connection]
<paule32> give it locales packages, other than shimira
prokhor_ has joined #commonlisp
acma has quit [Changing host]
acma has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
frgo has joined #commonlisp
eddof13 has joined #commonlisp
frgo has quit [Client Quit]
frgo has joined #commonlisp
frgo has quit [Remote host closed the connection]
frgo has joined #commonlisp
nij- has left #commonlisp [#commonlisp]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
comatory has quit [Ping timeout: 240 seconds]
jealousmonk has joined #commonlisp
Cymew has quit [Ping timeout: 260 seconds]
Josh_2 has joined #commonlisp
causal has quit [Quit: WeeChat 3.6]
<Josh_2> Good Morning :sunglasses:
aartaka has quit [Ping timeout: 244 seconds]
jolby has joined #commonlisp
<paule32> hello Josh_2
<paule32> i have found out the logic beyhond the locale lib, from my question request tomorrow morning
<paule32> but
<paule32> how can i show NAND - not and ?
<paule32> in normal way, AND, i represent it as: (defun funAND (A B) (if (and (= A 0) (= B 0)) (return-from funAND 0)))
<paule32> is the nand (not and) simply a chain to the (and ...
<paule32> ?
<paule32> (if (not (= (and (= A 0) (= B 0)) 0)
ec has joined #commonlisp
makomo_ has quit [Ping timeout: 252 seconds]
eddof13 has joined #commonlisp
<paule32> here e.g.: https://dpaste.com/E4UYZNZHU
tyson2 has quit [Remote host closed the connection]
<paule32> the shorter form of NAND: https://dpaste.com/88UV36FEF
<paule32> is that right ?
<jcowan> NAND should be just (NOT (AND a b))
<jcowan> hence the name
<_death> there's lognand
<_death> if you want to restrict it to 0 and 1, (ldb (byte 1 0) (lognand a b))
ttree has joined #commonlisp
cage has joined #commonlisp
Brucio-61 has quit [Remote host closed the connection]
Brucio-61 has joined #commonlisp
makomo has joined #commonlisp
jeosol has joined #commonlisp
makomo_ has joined #commonlisp
ec has quit [Remote host closed the connection]
jolby has quit [Quit: Client closed]
comatory has joined #commonlisp
ec has joined #commonlisp
prokhor__ has joined #commonlisp
Catie has joined #commonlisp
comatory has quit [Ping timeout: 252 seconds]
prokhor_ has quit [Ping timeout: 268 seconds]
comatory has joined #commonlisp
orestarod has joined #commonlisp
jmdaemon has joined #commonlisp
tyson2 has joined #commonlisp
<paule32> on NAND, and NOR, i am not sure if this right
<paule32> can you verify this ?
<Josh_2> onException_LogicErro what is this :sob:
jeosol has quit [Quit: Client closed]
<paule32> ah, typo, moment please, i will post the full source
karlosz has joined #commonlisp
<Catie> The boolean logic functions look correct to me, but the code is very non-idiomatic
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #commonlisp
igemnace has quit [Remote host closed the connection]
<Josh_2> paule32: why you do this to me? onException_LogicError ????
<Josh_2> camel case *and* snake case? Lisp uses kebab case :sob:
<paule32> Catie: i used emacs, and its indent
<Catie> Camel case could pose a problem as well if you're expecting the reader to treat symbols case-sensitively but don't set it up
<Catie> paule32: The indentation isn't the only non-idiomatic part of the code
<paule32> the logic, or the style ?
<Catie> The style. Near as i can tell the logic is fine
<paule32> i had thinking that i was hold your guide
<paule32> when i use emacs
<Catie> Emacs will take care of indentation --- though it seems that the clauses in your AND forms are misaligned --- but that's about the only style cleanup it'll do for you
<Josh_2> You could write a macro to make that cond form for you
<paule32> shows clean
<Josh_2> Or you could use the #'log<gate> funs
<Josh_2> (logxor 0 1) -> 1
<Josh_2> You could also use the :initform key within define-condition to set the messages without having to do it each time you call (error ..)
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
livoreno has joined #commonlisp
<paule32> in your prior example, i would prefer this style: https://dpaste.com/7DBMHEM6D
<paule32> but it is my mind, maybe not idomatic
<paule32> to save space/place
EsoAlgo has quit [Ping timeout: 244 seconds]
<Catie> It's definitely allowed, it's just code that'll look weird to the Common Lisp community in general
masinter has quit [Ping timeout: 252 seconds]
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
epony has quit [Quit: QUIT]
yottabyte has quit [Quit: Connection closed for inactivity]
morganw has joined #commonlisp
comatory_ has joined #commonlisp
pjb has joined #commonlisp
comatory has quit [Ping timeout: 260 seconds]
<paule32> thx Josh_2
<Josh_2> With Shasht is there a way to change the way certain objects are encoded?
<Josh_2> I do not want the slots within a local-time:timestamp to be encoded literally, I want to convert it to a machine readable date and output that instead :sob:
<paule32> utf-8 ?
<paule32> you could use ffc
<paule32> write a little date.c .so/.dll
<paule32> gcc -O2 -shared -fPIC ...
<Josh_2> talk about the long way round
<paule32> in clisp
<Josh_2> I will just write my own version of jojo's to-json method
<Josh_2> for shasht
epony has joined #commonlisp
<paule32> i dont know shasht, was a mind of thinking ...
tyson2 has quit [Remote host closed the connection]
<Josh_2> Shasht is json encoder/decoder
<Josh_2> is good :sunglasses:
Noisytoot has quit [Quit: ZNC 1.8.2 - https://znc.in]
<yitzi> Josh_2: author of shasht here. You can override SHASHT:PRINT-JSON-VALUE if you want.
<Josh_2> To change how local-time:timestamps are encoded?
<yitzi> Yes. It's a generic. Same signature as PRINT-OBJECT.
<Josh_2> Alright :)
<yitzi> Just ask if you need help.
paule32_ has joined #commonlisp
paule32_ has quit [Changing host]
paule32_ has joined #commonlisp
paule32 has quit [Ping timeout: 268 seconds]
<Josh_2> I think I got it (defmethod shasht:print-json-value ((value local-time:timestamp) stream)
<Josh_2> (format stream "~D" (local-time:timestamp-to-unix value)))
Lord_of_Life_ has joined #commonlisp
glaucon has quit [Quit: WeeChat 3.5]
Lord_of_Life has quit [Ping timeout: 244 seconds]
<Josh_2> With this I doubt I will need to write custom encoders for every class
<Josh_2> bit of a pita doing that
<Josh_2> Its great that you managed to get Shasht so fast while still keeping it generic!
<yitzi> Looks good
<Josh_2> The src of Jonathan is uhm well not so nice
<Josh_2> Is there a way to stop shasht from writing a newline for every item in an array?
Lord_of_Life_ is now known as Lord_of_Life
masinter has joined #commonlisp
Noisytoot has joined #commonlisp
<Josh_2> I guess its the pretty-print key
<yitzi> Sort of. Bind `CL:*PRINT-PRETTY*` to nil
<Josh_2> :thumbsup:
<yitzi> Or use the key as you say. The pretty printer is very basic, since shasht was originally designed for network messaging.
jeosol has joined #commonlisp
<jcowan> Of course, there is also the option of Traditional Lisp Identation, aka "Write everything as a solid wall of 80-column text with a minimum of spaces"
<jeosol> good morning all!
waleee has joined #commonlisp
<jeosol> aeth: are you here?
<jeosol> Or anyone making that create docker images for their CL application may be able to help with my question.
<jeosol> For context, I have been doing some benchmarking and explore different deployment of my SBCL workers - local vs remote machines and docker vs repl. The local (docker and repl) are only for sense checking the remote options (local and docker)
<jeosol> I am also testing on the kubernetes (GKE and minikube) and so far those results appear consistent.
<jeosol> Now my question is relates to my remote options: The remote with 'docker run' has a median response time of 3.5 seconds and the remote with 'repl' has a median of 5.1 seconds. The remote machine as no other load and the tasks sent to the workers are exactly identical
pve has quit [Quit: leaving]
<jeosol> is there a reason a remote repl run is slower? Also, there is not other jobs or tasks on the machine, just the repl (either bare or through docker run)
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mariari has quit [Ping timeout: 244 seconds]
cage has quit [Quit: rcirc on GNU Emacs 27.1]
mariari has joined #commonlisp
Brucio-61 has quit [Ping timeout: 268 seconds]
scymtym has quit [Ping timeout: 268 seconds]
<mathrick> so, I haven't used non-standard method combinations before, and I was hoping I had a good use-case for OR, but some further reading and experimentation makes me think it can't possibly work. Please correct me if I'm wrong:
<mathrick> so basically, I want "whoever can handle it first" style protocol for an object whose type is not known beforehand (because discovery is a part of the handling). But any method combination, including simple method combinations like OR, needs to have *distinct* specialisers between different methods
<mathrick> so I can't just say (defmethod foo or (obj) "try handler 1") (defmethod foo or (obj) "try handler 2"), because they will just be seen as redefining the same single method
<Bike> correct. there has to be some way to distinguish the methods.
<Bike> you can have distinct methods with the same specializers but different qualifiers, though.
<mathrick> I don't think it helps me, since I want the semantics of OR
<Bike> that doesn't help you with the OR combination, but you could have a custom method combination where you have arbitrary integer qualifiers, or something
<mathrick> oh, I see!
<mathrick> and just arbitrary keywords are OK qualifiers, right?
<Bike> Yes, the qualifiers are just a list of objects that's arbitrary other than that they can't be lists
<mathrick> so if I have a keyword that is the name of the backend implementing it, that would be enough to distinguish them?
<Bike> the code might be kind of confusing to keep track of, so i'd be careful with that. oh that sounds way better than integers confusion wise.
<Bike> i mean, with the standard method combination you can have :before and :after with the same specializers and you get distinct methods, right? same idea.
<mathrick> and for that I need to define a custom method combination using the long form of DEFINE-METHOD-COMBINATION?
<Bike> I think so
<mathrick> cool, thanks
eddof13 has joined #commonlisp
<mathrick> I actually have that open in a tab :)
<Bike> if only for method-combination-expand
<mathrick> was very much heading that way
<mathrick> Bike: so the very first snippet in the README has (:method-combination basic progn t), which I don't understand. I thought the name of the method combination was called "PROGN", and you use it like so: (:method-combination progn)
<Bike> basic is a method combination defined by the library
<Bike> described a little ways down the readme
<mathrick> ah!
orestarod has quit [Quit: Leaving]
comatory_ has quit [Ping timeout: 260 seconds]
comatory_ has joined #commonlisp
Brucio-61 has joined #commonlisp
pjb has quit [Ping timeout: 264 seconds]
<Josh_2> I tried a new style with my code where I write all my protocols for my entire system into all of their separate modules and then create a package called "implementation" where I specialize my generics appropriately
<Josh_2> I like
waleee has quit [Ping timeout: 248 seconds]
pranavats has left #commonlisp [Disconnected: Received SIGTERM]
pranavats has joined #commonlisp
cercopith has joined #commonlisp
cercopith_ has quit [Ping timeout: 268 seconds]
tyson2 has joined #commonlisp
cowboy8625 has quit [Quit: WeeChat 3.5]
ec has quit [Remote host closed the connection]
anticomputer has quit [Remote host closed the connection]
anticomputer has joined #commonlisp
ec has joined #commonlisp
jealousm` has joined #commonlisp
jealousmonk has quit [Ping timeout: 264 seconds]
cercopith_ has joined #commonlisp
causal has joined #commonlisp
cercopith__ has joined #commonlisp
cercopith has quit [Ping timeout: 260 seconds]
cercopith_ has quit [Ping timeout: 252 seconds]
bilegeek has joined #commonlisp
cercopith_ has joined #commonlisp
cercopith__ has quit [Ping timeout: 268 seconds]
shka has quit [Ping timeout: 268 seconds]
azimut has joined #commonlisp
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
justache is now known as justache_test
justache_test is now known as justache
luna-is-here has quit [Ping timeout: 255 seconds]
pranavats has left #commonlisp [Disconnected: Replaced by new connection]
pranavats has joined #commonlisp
random-nick has quit [Ping timeout: 252 seconds]
luna-is-here has joined #commonlisp
rgherdt has quit [Read error: Connection reset by peer]
rgherdt_ has joined #commonlisp
jolby has joined #commonlisp
orestarod has joined #commonlisp
anticomputer has quit [Remote host closed the connection]
azimut has quit [Ping timeout: 258 seconds]
anticomputer has joined #commonlisp
gxt has quit [Ping timeout: 258 seconds]
azimut has joined #commonlisp
gxt has joined #commonlisp
luna-is-here has quit [Read error: Connection reset by peer]
thuna` has quit [Remote host closed the connection]
luna-is-here has joined #commonlisp
euandreh has quit [Ping timeout: 264 seconds]
pranavats has left #commonlisp [Error from remote client]
orestarod has quit [Ping timeout: 260 seconds]
anticomputer has quit [Remote host closed the connection]
azimut has quit [Read error: Connection reset by peer]
gxt has quit [Read error: Connection reset by peer]
<jeosol> what is the recommended way to use types with a function?  defun plus a declaim vs defmethod vs others(?)
anticomputer has joined #commonlisp
azimut has joined #commonlisp
gxt has joined #commonlisp
morganw has quit [Remote host closed the connection]
euandreh has joined #commonlisp
euandreh has quit [Client Quit]
cercopith has joined #commonlisp
euandreh has joined #commonlisp
eddof13 has joined #commonlisp
cercopith_ has quit [Ping timeout: 252 seconds]
pranavats has joined #commonlisp
bilegeek has quit [Quit: Leaving]
<Josh_2> What do you mean?
<Josh_2> To make functions static?
jmdaemon has quit [Quit: ZNC 1.8.2 - https://znc.in]
ec has quit [Remote host closed the connection]
cowboy8625 has joined #commonlisp
<aeth> jeosol: I can't think of why it would be slower
<aeth> jeosol: defmethod uses classes, defun with declaim and/or declare uses types. There is a bit of a distinction here, with numbers and arrays
azimut_ has joined #commonlisp
<jeosol> Josh_2: Josh it's more on the documentation side of the things but have types enforced somehow. I normally just use defmethod but not sure what overhead that has
azimut has quit [Ping timeout: 258 seconds]
<aeth> e.g. this library lets you generic dispatch on types (only really useful for arrays and numbers). https://github.com/markcox80/specialization-store/
<jeosol> aeth: thanks for your response. I was afraid the post was out of topic. I was just concluding the benchmarking test and have been able to get the repl to be generally less that docker. It's only on the remote machines I noticed the disparity
<mathrick> it's not necessarily enforced, and the implementation is free to ignore it, AFAIK
<aeth> it is ime easier to use DECLARE over DECLAIM FTYPE unless you need to specify the return type.
<aeth> jeosol: different versions of a library perhaps?
<mathrick> but it's also allowed to take that into consideration for optimisation purposes
<jeosol> aeth: I can't think of why bare repl would be slow than repl within docker, but I will investigate further
<aeth> or maybe docker is somehow caching everything into a FASL while the bare REPL somehow isn't
<aeth> (so one is compiling and the other isn't)
<jeosol> mathrick: thanks for that link. ftype is more of what I was thinking of
<aeth> mathrick: which is why I wrote a DEFINE-FUNCTION macro to handle this whole mess (other macros exist; they are less complete and some are even GPL, which makes them unusable for most libraries)
<mathrick> ew, GPL is a hot mess, especially in CL
<aeth> it can CHECK-TYPE (slower, always works), it can DECLARE (faster, don't trust it to work so it's performance-over-reliability), it can DECLAIM (some things need to be declaimed... return types and inline)
<jeosol> aeth: not different versions per se. I have functions with defun and try to use names that could convey intent but I am think if I can start adding some form of documentation that could also carry type information.
<aeth> mathrick: yeah, everyone always brings up defstar, and probably encouraged a bunch of people to accidentally violate the GPL in the process
<jeosol> I do use ftype in a few places, low-level functionality with array-based functions to "speed" things up(?),
<jeosol> or for optimization
<jeosol> aeth: good point about fasl. I try to use essentially the same process to start the repls. I create a core file and the start SBCL with the core-file in both cases.
<aeth> declarations can actually slow things down in SBCL because it inserts a checks (unless (safety 0) but never do (safety 0)), but not in checks that are visible in DISASSEMBLE
<mathrick> aeth: I've never, ever liked the whole "linking is derivative work" thing. Even in C it makes absolutely no sense and is, IMHO, an abuse of the copyright law
pranavats has left #commonlisp [Error from remote client]
<aeth> (defun foo (x) (declare (single-float x)) (1+ x)) (disassemble #'foo) ; seems nice in SBCL, you eliminated a generic +
<aeth> (sb-disassem:disassemble-code-component #'foo) ; oops, there's actually a lot of checking going on in SBCL that isn't visible to you portably
<jeosol> aeth: I now use multistage image build, build the core file in the first pass, copy it in the second stage. I noticed this improved the run times, not sure why - perhaps smaller image?
<dbotton> "GPL is a hot mess, especially in CL" it is the number one reason interestingly enough I came to use common-lisp the absence of GPL on all the essential parts
<aeth> but in practice if you need to do DECLARE and it's not so trivial that you can just inline it, it's probably going to be a performance win to DECLARE types
<aeth> dbotton: the LGPL is much worse of a choice and the LLGPL is even worse because it's a custom license.
<dbotton> agreed
<mathrick> I used to think GPL had a place, way back when I was a kid and the whole open source thing was a novelty
<mathrick> but these days I think it's cancerous
<dbotton> I wrote more lines that you can imaging as GPL and LGP
<aeth> the LGPL is best interpreted to mean that you can't really build an all-in-one binary (which is how most people deploy Lisp applications). You have to have swappable FASLs of the LGPL parts.
<mathrick> aeth: how's LGPL even worse though?
<jeosol> haha. not a licensing expert, so anything GPL should be avoided?
<dbotton> yes
<aeth> (not a lawyer though)
<jeosol> thanks
<dbotton> unless a you want GPL
<aeth> (which is one issue with the LGPL just there, because you would need to see one)
<dbotton> AGPL is even worse
<aeth> the GPL's fine, though, as long as everything's compatible (so no library that's GPLv2 only, etc., etc.)
<jeosol> not sure the impact of the GPL and derivatives, but I use core files a lot and further package everything into a single docker image with all dependencies (sbcl + code + data). So it's drop and go
<dbotton> for developer tools won't touch again anything GPL
<dbotton> I don't care if final product GPL if userland
<mathrick> aeth: not sure how LGPL implies that? At worst, LGPL reverts to being GPL if you have an all-in-one binary, but I don't really think it does even that
<dbotton> The problem is the lawyers for some company in the future attacking your work
<aeth> mathrick: my point is that the LGPL isn't really useful for libraries based on the way Lisp works because now it forces you into some awkward work-with-the-LGPL application deploying strategy
<dbotton> I've been there twice
<dbotton> You won't be able to defend yourself
<aeth> mathrick: which you would have to run by a lawyer if you're serious
<dbotton> for the money free software makes.....
<jeosol> dbottom: that's good to know. I have largely ignored this aspect. I primarily used SBCL and supposedly open source CL libs
<aeth> mathrick: by contrast, the GPL is easy... you just use the GPL or don't use the library
<mathrick> aeth: yeah, thought this is just an extension of the idiotic "static linking is somehow derivation", even though it's patently absurd because most of the time static vs dynamic linking is a switch and you can compile the same code both ways (in C that is)
<jeosol> are there popular CL libs that have this issue? I must admit I haven't paid attention to the licensing of some of the libs I used.
<dbotton> CLOG I make sure completely free GPL, with great gratitude fukamachi changed CLACK from lgpl to mit/bsd for clog
<jeosol> good to know.
<jeosol> I think remember wanted to do some machine learning work and clml had some restrictive license, verified with some others it was the case and I eventually left it.
<dbotton> like I said the issue is that even if LGPL some day ends up being ok in a court, someone can restrict your software till for many years
<dbotton> your competition can play dirty pool a long time
<dbotton> and will
<dbotton> and maybe, but will
<dbotton> and this is if you can afford to defend