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/>
tibfulv_ has joined #commonlisp
tibfulv has quit [Remote host closed the connection]
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 265 seconds]
Lord_of_Life_ is now known as Lord_of_Life
kevingal has quit [Ping timeout: 246 seconds]
kevingal_ has quit [Ping timeout: 246 seconds]
lucas_ta has joined #commonlisp
lucasta has quit [Ping timeout: 252 seconds]
lucas_ta has quit [Remote host closed the connection]
lucas_ta has joined #commonlisp
lucas_ta has quit [Client Quit]
igemnace has quit [Remote host closed the connection]
Andrew is now known as AndrewYu
random-nick has quit [Ping timeout: 252 seconds]
spiderbit has joined #commonlisp
<spiderbit> hey I try to resort (the keys) of a hash-table
<spiderbit> http://ix.io/4uuO
<spiderbit> basically I want to have the entries in history to have the lowest keys so the newest entry in history the lowest ke
<spiderbit> but I might not understand hash-table enough and how it's stored
<spiderbit> and basically push visible-windows down the list to the end
kevingal has joined #commonlisp
kevingal_ has joined #commonlisp
robin has quit [Remote host closed the connection]
<Bike> spiderbit: the keys and values of a hash table are not stored in any defined order, let alone sorted. for example there is no guarantee that if you run this loop twice it will get the entries in the same order.
<spiderbit> yeh I collected it to a list already
<spiderbit> still don't see how to remove lets say something lika that (remove '(1 2) '(1 2 3)
<spiderbit> I can do it with mapcar
<spiderbit> but only one by one
<spiderbit> and always overwrite the original list
<Bike> Um, that also won't work with remove.
<spiderbit> but that is not very elegant
<spiderbit> yes I noticed that this doesn't work I ask what's the name of the function that does it :D
<Bike> set-difference, i guess?
<spiderbit> is there a list library I have to load to get better tools
<spiderbit> basic clisp is so primitive (come from elisp)
<spiderbit> * (set-difference (list 1 2) (list 1 2 3) :test 'equal)
<spiderbit> NIL
<spiderbit> shouldn't that work?
<hayley> Wrong way around.
<hayley> ,(set-difference (list 1 2 3) (list 1 2)) ; {1, 2, 3} \ {1, 2}
<ixelp> (set-difference (list 1 2 3) (list 1 2)) => (3)
Catie has quit [Quit: ZNC 1.8.2 - https://znc.in]
Catie has joined #commonlisp
bilegeek has joined #commonlisp
kevingal_ has quit [Ping timeout: 276 seconds]
kevingal has quit [Ping timeout: 276 seconds]
beach has joined #commonlisp
markb1 has quit [Ping timeout: 252 seconds]
markb1 has joined #commonlisp
dcb has quit [Quit: MSN Messenger v2.16.1]
kagev has quit [Ping timeout: 248 seconds]
wilfred has joined #commonlisp
<edwlan[m]> ,(+ #1=21 #1#)
<ixelp> (+ #1=21 #1#) => 42
bilegeek has quit [Quit: Leaving]
<spiderbit> ahh thx ixelp
<spiderbit> I did it without it
<spiderbit> horrible code but it works :D
<spiderbit> http://ix.io/4uvi
tibfulv_ has quit [Remote host closed the connection]
<beach> spiderbit: It looks to me like either you are using SETQ on an undefined variable, or you are not respecting the convention of earmuffs on special variables.
<beach> And why do you use (LIST) rather than '()?
<spiderbit> I don't know why maybe to be less confused :D
<beach> But now you are exposing the code to others, so you are instead confusing those others.
<spiderbit> well I wrote that it's horrible
<beach> Also, you need to use slime-indentation so that your conditional LOOP clauses are indented correctly.
<beach> Oh, so you don't want feedback?
<spiderbit> pfff some feedback maybe
<spiderbit> I don't know
<spiderbit> would have to rewrite everything probably
<spiderbit> with some sort and test
<spiderbit> instead of pushing the items forth and back in the list
<spiderbit> but not so much in style
<beach> What is it that you want to do?
<spiderbit> the identation is my emacs doing
<spiderbit> well I need(ed) a stumpwm
<spiderbit> -> rofi window list
tibfulv has joined #commonlisp
<beach> If you are using SLIME, then the DO after the WHEN should be indented.
<spiderbit> that sorts windows according to history
<beach> So why not use SORT?
cdegroot has quit [Quit: No Ping reply in 180 seconds.]
<spiderbit> because I am to long awake to get that done
cdegroot has joined #commonlisp
<spiderbit> not written much such tests and such complex one
<beach> If you map an anonymous function over a variable named MY-WINDOWS, it would be better to call the parameter (say) WINDOW than VALUE.
<spiderbit> true
<beach> We usually plural forms for a list of things, and singular forms for the item of such a list.
<beach> And it looks like this function does too many things. Maybe delegate each phase to a separate named function.
<spiderbit> I think in the end it should be a sort function
<beach> Then you can remove the comments and use the name of the function as documentation.
<spiderbit> that would probably be shorter
robin has joined #commonlisp
<beach> I am saying this a general advice. If you find yourself having a long function doing multiple things, where each thing has a comment on it, it may be better to extract each thing to a separate function where the name reflects the purpose.
Catie has quit [Quit: ZNC 1.8.2 - https://znc.in]
<beach> And you should definitely use earmuffs on special variables like *HISTORY* rather than HISTORY.
<spiderbit> ohh
Catie has joined #commonlisp
<spiderbit> when do you use that?
<spiderbit> is there a rule?
<spiderbit> I did not even know what you mean with earmuffs :D
<mfiano> ANything defined with DEFVAR, DEFVAR, or is declared special with DECLARE needs to be marked as such visually for other readers, because that variable is no longer lexical.
<mfiano> oops
<mfiano> DEFVAR/DEFPARAMETER
<spiderbit> ahh ok
<mfiano> (Or proclaimed special some other way)
<beach> spiderbit: That's a convention, yes.
<spiderbit> sorry to have posted that, didn't want to confuse somebody, was just proud that I did it and maybe somebody wanted to refactor it for me (unlikely) but you never know, but still thanks for the tipps to write better code
<beach> spiderbit: And where is the variable VISIBLE-WINDOWS defined?
<beach> spiderbit: No reason to be sorry. Now you got valuable feedback.
<spiderbit> it's a stumpwm function basically
<mfiano> It would be incredibly confusing otherwise, even to the writer of the code, especially when shadowing is involved.
<beach> I am talking about the variable.
<beach> spiderbit: (setq .... visible-windows (list))
<spiderbit> yes
<beach> Where is it defined?
<spiderbit> it seems to work with setq alone
<beach> spiderbit: Yet, that's undefined behavior.
<beach> spiderbit: A variable must be defined before being used.
<spiderbit> ok yes normaly I would use let
<mfiano> Likely in the stumpwm user configuration package or wherever those other mysterious symbols come from
<beach> spiderbit: Yes, LET is always better if a lexical variable works.
<spiderbit> I am just barely could get that done :)
<beach> spiderbit: If not, you must use DEFVAR or DEFPARAMETER to define the variable first.
<spiderbit> so I had to take some shortcuts I guess
<spiderbit> ok
<beach> Again, there is no reason to apologize. Just take the advice and improve you code.
<mfiano> Like *xwin-to-window* was previously initialized as a hash table and populated at some point. I thought there was an implicit stumpwm package switch when I first saw it, anyway
<spiderbit> yeah I just am a bit tired well 7 a'clock a.m. so my concentration is limited. my main problem was to deal with that hash table, and trying to "sort" it, after solving that by collecting it into a list and work with the list instead I was kind of fine, but yes...
<spiderbit> well when I have a ear for questions
<spiderbit> in elisp I can at least have a comment as first parameter for lambda
<spiderbit> if not for other macros, too
<spiderbit> that's not there in clisp, right?
<spiderbit> (lambda "it does that and that" (x) ...)
<beach> CLISP is an implementation of Common Lisp. Please use "CL" if you have to abbreviate the Common Lisp name.
<beach> spiderbit: That's not a comment. It's a string.
<beach> But you can write (lambda #| a block comment |# (...) ...)
<spiderbit> well it's both
<spiderbit> in elisp
<beach> That's of no importance here.
<spiderbit> so the answer is no :P
<beach> Like I said, you can have a comment there, but not a string.
<spiderbit> yes thx
<beach> ywlcm
czy has joined #commonlisp
<mfiano> Elisp does not allow documentation string for lambda forms either.
<spiderbit> it does just not on the place I said
<spiderbit> (lambda ARGS [DOCSTRING] [INTERACTIVE] BODY)
<spiderbit> after args
<spiderbit> it's nice because you then can just copy paste it to a function
<spiderbit> and add the name
<mfiano> You can place a string as the first expression
<mfiano> How would you query it though. Seems like it is like if you were to place 42 there.
<mfiano> DCE'd away
<mfiano> What you gave above was a string before the argument list. Much different
<spiderbit> yes I already corrected
<spiderbit> ...it does just not on the place I said
<mfiano> The body of a lambda is like any function. Include any side-effecting expressions you want.
<spiderbit> well in that way
<spiderbit> it works in clisp too I guess
<spiderbit> just not in the api doc explicitly mentioned
<beach> spiderbit: You can put a documentation in a Common Lisp LAMBDA macro form too.
<beach> spiderbit: Please don't use CLISP as an abbreviation for Common Lisp.
<beach> spiderbit: CLISP is an implementation of the Common Lisp standard.
<spiderbit> ok
<beach> clhs lambda
<ixelp> CLHS: Meanings for LAMBDA
<beach> Look at the "macro" definition.
<spiderbit> ahh ok
<mfiano> ,(documentation (lambda (x) "Docstrings are good" (+ x 42)) 'function)
<ixelp> (documentation (lambda (x) "Docstrings are good" (+ x 42)) 'function) => NIL
<mfiano> I suppose I should have printed it to *standard-output*
<mfiano> ,(write-line (documentation (lambda (x) "Docstrings are good" (+ x 42)) 'function))
<ixelp> (write-line (documentation (lambda (x) "Docstrings are good" (+ x 42)) 'function)) ERROR: The value NIL is not of the expected type ARRAY.
<mfiano> I will stop spamming and remember my CL some other time, and instead invite you to join #clschool
<spiderbit> me?
<hayley> ,(documentation (lambda (x) "Docstrings are good" (+ x 42)) 't)
<ixelp> (documentation (lambda (x) "Docstrings are good" (+ x 42)) 't) => NIL
<hayley> Boggle.
<mfiano> wait...
<mfiano> the above works on SBCL...does it really not return the value on CCL?
<mfiano> ,(format t "~a version ~a" (lisp-implemntation-type) (lisp-implementation-version))
<ixelp> (format t "~a version ~a" (lisp-implemntation-type) (lisp-implementation-version)) ERROR: Undefined function LISP-IMPLEMNTATION-TYPE called with arguments () .
<mfiano> security hardening getting in the way of reliability maybe?
<spiderbit> well I am out for today thx for the help again see ya!
spiderbit has quit [Quit: Client closed]
<mfiano> Ah I cant spell. I will just go back to code. Sorry for the bot games.
<hayley> ,(lisp-implementation-type) ; typo
<ixelp> (lisp-implementation-type) => "Clozure Common Lisp"
<mfiano> Yeah, I saw that, but I'm curious why #'documentation does not return a string.
<mfiano> ,(print (documentation 'list 'function))
<ixelp> (print (documentation 'list 'function)) ↩ "Return constructs and returns a list of its arguments." => "Return constructs and returns a list of its arguments."
<mfiano> My theory is gone now. I guess the new theory is write-line is shadowed?
<beach> ,(symbol-package 'write-line)
<ixelp> (symbol-package 'write-line) => #<Package "COMMON-LISP">
les has quit [Ping timeout: 244 seconds]
les has joined #commonlisp
pjb has joined #commonlisp
<mfiano> Well implementations are permitted to throw away references to any docstrings, and my knowledge is NIL with CCL.
<gilberth> mfiano: ,(lisp-implementation-type)
<ixelp> (lisp-implementation-type) => "Clozure Common Lisp"
<mfiano> It is curious only because of that ARRAY type something is expecting. I do not know how to debug CCL and will refrain from torturing this channel.
<mfiano> Oh hello bot owner gilberth
<pjb> mfiano: there's a #ccl
<mfiano> gilberth: The question is what is wrong with: ,(write-line (documentation (lambda (x) "Docstrings are good" (+ x 42)) 'function))
<ixelp> (write-line (documentation (lambda (x) "Docstrings are good" (+ x 42)) 'function)) ERROR: The value NIL is not of the expected type ARRAY.
<mfiano> Yes
<beach> If the documentation returns NIL you don't have a string.
<mfiano> Yeah, I was just trying to guess as to why it is truly NIL. I am still guessing that CCL under the optimization qualities in use by the bot just doesn't store this for function objects, at least constructed in this way.
<beach> But then you don't have to involve WRITE-LINE in this at all.
<mfiano> Correct. That was just used to verify that it was indeed not requiring me to print the result to *standard-output* to get a non-NIL result from the bot.
wilfred has quit [Quit: Connection closed for inactivity]
<mfiano> Which goes back to the start of the conversation when I asked why you would even want a documentation string on a lmabda. Documentation strings are consumed by human clients, right? I would have assumed until fbound and accessible it should be a comment, since there doesn't appear to be a way to query for that in Elisp, either, but maybe I am wrong.
rgherdt has joined #commonlisp
<mfiano> I do believe that a large part of the problem is a lack of convention, or even a hint of a concensus on what format well-written code should use for documentation strings (typesetting, markup emphasizing different code context terms used in prose, etc), nor have any of the surrounding tooling been started on, only discussed a few times, IIRC.
<jackdaniel> lambda may be accessed as an argument and then installed as a named function in the global environment
<beach> I added the omitted paper "Representing method combinations" to metamodular.com/SICL/
<beach> I think DOCUMENTATION is fundamentally broken. There is not even a way to internationalize it.
<beach> The good news, of course, is that there is no obligation to use it.
<mfiano> Or we could extend its definition to include, in addition to a STRING, some conventional library's documentation object type, or an abstract tree of conses representing something that could be parsed, with the hope of seeing as big of adoption as |3b|'s package-local nicknames?
<mfiano> a STRING or NULL type
attila_lendvai_ has joined #commonlisp
<mfiano> My point here is moreso, since it _is_ fundamentally broken, let's modify the standard by convention. PLN's were needed because Lisp was designed at a time when code sharing meant something completely different than the modern sense of it.
<mfiano> Common Lisp, that is.
<beach> I think it is much easier to define a separate function than to get people to agree to change the standard by convention.
<mfiano> I can't argue over that, for sure, except maybe to say easy is not always the correct path.
<mfiano> Sometimes hard work must be done. You are one of few Lispers that writes detailed findings of your research. It is difficult to find even code with good comments and documentation strings, not to mention 'offline' documents such as those.
Krystof has joined #commonlisp
attila_lendvai_ has quit [Ping timeout: 250 seconds]
shka has joined #commonlisp
rgherdt has quit [Ping timeout: 250 seconds]
rgherdt has joined #commonlisp
azimut has joined #commonlisp
scymtym has joined #commonlisp
foretspaisibles has joined #commonlisp
_cymew_ has joined #commonlisp
foretspaisibles has quit [Quit: Client closed]
_cymew_ has quit [Ping timeout: 255 seconds]
_cymew_ has joined #commonlisp
cage has joined #commonlisp
thonkpod has quit [Ping timeout: 264 seconds]
thonkpod has joined #commonlisp
_cymew_ has quit [Ping timeout: 246 seconds]
pkal has quit [Remote host closed the connection]
karlosz has quit [Quit: karlosz]
Krystof has quit [Ping timeout: 254 seconds]
random-nick has joined #commonlisp
karlosz has joined #commonlisp
pkal has joined #commonlisp
pkal has quit [Remote host closed the connection]
_cymew_ has joined #commonlisp
Krystof has joined #commonlisp
semarie has quit [Quit: WeeChat 3.8]
avocadoist has quit [Ping timeout: 240 seconds]
semarie has joined #commonlisp
pkal has joined #commonlisp
tasty_ has joined #commonlisp
tasty_ has quit [Changing host]
tasty_ has joined #commonlisp
gjvc_ has joined #commonlisp
jackdani1l has joined #commonlisp
selfish has joined #commonlisp
viaken2 has joined #commonlisp
scymtym_ has joined #commonlisp
empwilli_ has joined #commonlisp
tasty has quit [Remote host closed the connection]
tevo has quit [Write error: Broken pipe]
pve has joined #commonlisp
Cymew has joined #commonlisp
mfiano_ has joined #commonlisp
luna-is-here_ has joined #commonlisp
phantomics has quit [Excess Flood]
_cymew_ has quit [Remote host closed the connection]
scymtym has quit [Ping timeout: 320 seconds]
hhdave has quit [Ping timeout: 320 seconds]
viaken has quit [Ping timeout: 320 seconds]
jackdaniel has quit [Ping timeout: 320 seconds]
pkal has quit [Remote host closed the connection]
pkal has joined #commonlisp
gjvc has quit [Ping timeout: 320 seconds]
empwilli has quit [Ping timeout: 320 seconds]
luna-is-here has quit [Ping timeout: 305 seconds]
flip214 has quit [Ping timeout: 305 seconds]
mfiano has quit [Ping timeout: 305 seconds]
micro has quit [Ping timeout: 305 seconds]
flip214 has joined #commonlisp
lucasta has joined #commonlisp
phantomics has joined #commonlisp
micro has joined #commonlisp
edgar-rft has quit [Quit: Leaving]
Lycurgus has joined #commonlisp
markb1 has quit [Ping timeout: 260 seconds]
markb1 has joined #commonlisp
Lycurgus has quit [Client Quit]
karlosz has quit [Quit: karlosz]
edgar-rft has joined #commonlisp
karlosz has joined #commonlisp
<pjb> mfiano_: documentation on lambdas could be useful: (documentation (let ((a (lambda () "this function will return A" 'a)) (b (lambda () "this function will crash and burn" (/ 0)))) (if (zerop (random 2)) a b)) t) --> "this function will return A" ; of course if the implementation returns NIL, you may take your chances.
monoidog has joined #commonlisp
<pjb> Otherwise, it's trivial to design a documentation system, internationnalised, and with a specific format or formats. something like: https://termbin.com/ggp6
<pjb> The translation and format conversion could be provided by external tools such as ChatGPT and pandoc.
lucas_ta has joined #commonlisp
lucasta has quit [Ping timeout: 248 seconds]
simendsjo has joined #commonlisp
bjorkintosh has joined #commonlisp
bjorkintosh has quit [Changing host]
bjorkintosh has joined #commonlisp
azimut has quit [Ping timeout: 240 seconds]
monoidog has quit [Remote host closed the connection]
gxt__ has quit [Ping timeout: 240 seconds]
gxt__ has joined #commonlisp
simendsjo has quit [Ping timeout: 252 seconds]
igemnace has joined #commonlisp
kagevf has joined #commonlisp
Krystof has quit [Ping timeout: 248 seconds]
Krystof has joined #commonlisp
azimut has joined #commonlisp
gxt__ has quit [Ping timeout: 240 seconds]
gxt__ has joined #commonlisp
dcb has joined #commonlisp
Krystof has quit [Ping timeout: 255 seconds]
vassenn has joined #commonlisp
ebrasca has joined #commonlisp
Oladon has joined #commonlisp
Krystof has joined #commonlisp
mfiano_ is now known as mfiano
attila_lendvai_ has joined #commonlisp
Inline has joined #commonlisp
shka has quit [Quit: Konversation terminated!]
shka has joined #commonlisp
Posterdati has quit [Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/]
Posterdati has joined #commonlisp
rgherdt has quit [Ping timeout: 248 seconds]
rgherdt has joined #commonlisp
attila_lendvai_ has quit [Ping timeout: 246 seconds]
attila_lendvai_ has joined #commonlisp
rgherdt has quit [Ping timeout: 264 seconds]
attila_lendvai_ has quit [Ping timeout: 252 seconds]
lucas_ta has quit [Remote host closed the connection]
Krystof has quit [Ping timeout: 255 seconds]
johnjaye has joined #commonlisp
vassenn has quit [Quit: Leaving]
<semz> If a (Gray) stream supports querying the file-position, can it be assumed that it'll also support seeking? Is it at least reasonable to assume that (file-position stream (file-position stream)) is a NOP and that the stream is seekable if it returns true?
inline__ has joined #commonlisp
Inline has quit [Remote host closed the connection]
<yitzi> file-position isn't part of the Gray Stream protocol.
<pjb> semz: I wouldn't make such an assumption. Some devices may have a driver that keep a record of the read or written byte count, such giving a file-position, but that is unable to modify it (other than by reading or writing further).
spiderbit has joined #commonlisp
<pjb> yitzi: indeed. However, there are implementation specific API. cf. trivial-gray-stream.
<yitzi> Yes, it is an extension.
<semz> Huh, the more you know; seems to be a best effort thing by t-g-s
<semz> well that nips this in the bud
<pjb> That said, you may be able to fake it when it's not available.
attila_lendvai has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 28.2]
spiderbit has quit [Quit: Client closed]
attila_lendvai has quit [Read error: Connection reset by peer]
spiderbit has joined #commonlisp
attila_lendvai has joined #commonlisp
spiderbit has quit [Client Quit]
spiderbit has joined #commonlisp
spiderbit has quit [Quit: Client closed]
spiderbit has joined #commonlisp
spiderbit has quit [Client Quit]
Cymew has quit [Ping timeout: 260 seconds]
micro has quit [*.net *.split]
edgar-rft has quit [*.net *.split]
karlosz has quit [*.net *.split]
micro has joined #commonlisp
edgar-rft has joined #commonlisp
jfb4 has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
spiderbit has joined #commonlisp
akoana has joined #commonlisp
random-nick has quit [Ping timeout: 252 seconds]
spiderbit has left #commonlisp [#commonlisp]
random-nick has joined #commonlisp
ec has joined #commonlisp
ec has quit [Client Quit]
ec has joined #commonlisp
kaskal has quit [Quit: ZNC - https://znc.in]
kaskal has joined #commonlisp
attila_lendvai has quit [Ping timeout: 252 seconds]
igemnace has quit [Remote host closed the connection]
lottaquestions has quit [Remote host closed the connection]
lottaquestions has joined #commonlisp
glaucon has joined #commonlisp
fe[nl]ix has quit [Quit: Valete!]
glaucon has quit [Read error: Connection reset by peer]
rendar has quit [Quit: Leaving]
fe[nl]ix has joined #commonlisp
sjl has quit [Quit: WeeChat 3.6]
shka has quit [Ping timeout: 246 seconds]
sjl has joined #commonlisp
lucasta has joined #commonlisp
wilfred has joined #commonlisp
rendar has joined #commonlisp
rendar has quit [Changing host]
rendar has joined #commonlisp
azimut has quit [Ping timeout: 240 seconds]
ebrasca has quit [Remote host closed the connection]
pve has quit [Quit: leaving]
rgherdt has joined #commonlisp
Oladon has quit [Quit: Leaving.]
keinbock is now known as jamesmartinez
jmdaemon has joined #commonlisp
pjb has quit [Ping timeout: 248 seconds]
rgherdt has quit [Remote host closed the connection]
LW has joined #commonlisp