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>
scymtym has joined #commonlisp
Oddity has quit [Remote host closed the connection]
notzmv has joined #commonlisp
random-nick has quit [Ping timeout: 250 seconds]
Oddity has joined #commonlisp
Jach has quit [Remote host closed the connection]
makomo_ has quit [Ping timeout: 246 seconds]
makomo has quit [Ping timeout: 264 seconds]
CptKirk has quit [Ping timeout: 256 seconds]
taiju has quit [Ping timeout: 268 seconds]
abrantesasf has quit [Remote host closed the connection]
Catie has quit [Quit: Leaving work]
jealousmonk has quit [Quit: ERC (IRC client for Emacs 27.1)]
tyson2 has quit [Remote host closed the connection]
jkordani has quit [Quit: Client closed]
taiju has joined #commonlisp
prxq_ has joined #commonlisp
prxq has quit [Ping timeout: 268 seconds]
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
<beach> Good morning everyone!
zazzerino has quit [Ping timeout: 250 seconds]
spec has quit [Quit: ZNC - http://znc.in]
mrSpec has joined #commonlisp
les has quit [Quit: Adios]
derwolf has quit [Quit: Bye]
ullbeking has quit [Read error: Connection reset by peer]
les has joined #commonlisp
derwolf has joined #commonlisp
ullbeking has joined #commonlisp
froggey has quit [Remote host closed the connection]
froggey has joined #commonlisp
katco has quit [Ping timeout: 265 seconds]
Duuqnd has quit [Ping timeout: 265 seconds]
CodeBitCookie[m] has quit [Ping timeout: 265 seconds]
Arcsech has quit [Ping timeout: 265 seconds]
akater[m] has quit [Ping timeout: 265 seconds]
loke[m] has quit [Ping timeout: 265 seconds]
MatrixTravelerb4 has quit [Ping timeout: 265 seconds]
dualinverter[m] has quit [Ping timeout: 265 seconds]
luis` has quit [Ping timeout: 265 seconds]
saltrocklamp[m] has quit [Ping timeout: 265 seconds]
rdrg109_ is now known as rdrg109
akater[m] has joined #commonlisp
MatrixTravelerb4 has joined #commonlisp
Josh_2 has quit [Remote host closed the connection]
Arcsech has joined #commonlisp
katco has joined #commonlisp
CodeBitCookie[m] has joined #commonlisp
Duuqnd has joined #commonlisp
loke[m] has joined #commonlisp
Bike has quit [Quit: Lost terminal]
<dieggsy> beach: mernin
dualinverter[m] has joined #commonlisp
luis` has joined #commonlisp
saltrocklamp[m] has joined #commonlisp
taiju has quit [Ping timeout: 252 seconds]
semz has quit [Ping timeout: 268 seconds]
semz has joined #commonlisp
Psybur has quit [Remote host closed the connection]
taiju has joined #commonlisp
waleee has quit [Ping timeout: 246 seconds]
Nilby has joined #commonlisp
<gin> beach: Good morning!
kuler has joined #commonlisp
kuler has quit [Remote host closed the connection]
<jmercouris> Good morning
karlosz has joined #commonlisp
karlosz has quit [Client Quit]
wilfred has joined #commonlisp
<jmercouris> I should probably use symbol-name rather than format with aesthetic directive
<jmercouris> I had never considered it until the conversation above
karlosz has joined #commonlisp
gaqwas has joined #commonlisp
robin_ has joined #commonlisp
robin has quit [Ping timeout: 252 seconds]
robin_ has quit [Ping timeout: 245 seconds]
robin_ has joined #commonlisp
taiju has quit [Ping timeout: 245 seconds]
karlosz has quit [Quit: karlosz]
pve has joined #commonlisp
karlosz has joined #commonlisp
notzmv has quit [Ping timeout: 268 seconds]
makomo has joined #commonlisp
amb007 has quit [Ping timeout: 245 seconds]
amb007 has joined #commonlisp
karlosz has quit [Quit: karlosz]
Cymew has joined #commonlisp
shka has joined #commonlisp
taiju has joined #commonlisp
gaqwas has quit [Ping timeout: 265 seconds]
amb007 has quit [Ping timeout: 265 seconds]
hajovont` is now known as hajovonta
amb007 has joined #commonlisp
dec0d3r has quit [Remote host closed the connection]
makomo_ has joined #commonlisp
makomo_ has quit [Client Quit]
makomo_ has joined #commonlisp
cosimone has joined #commonlisp
<gin> is (return-from func nil) the only way to return from the middle of a func? is repeating the function name 'func' necessary?
<beach> Yes, because you can have nested functions with different names, so the compiler would have to guess otherwise.
<gin> no macro in CLHS to just return NIL (or a value) from the innermost function?
<beach> No. I suggest you get over it and move on.
<gin> ok :) thanks beach
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
robin_ is now known as robin
iamFIREcracker has joined #commonlisp
iamFIREc1 has quit [Ping timeout: 260 seconds]
<mfiano> Often times you can use control flow operators to restructure a function use RETURN or RETURN-FROM, and it may or may not make the functionality clearer.
hajovonta has quit [Ping timeout: 252 seconds]
<mfiano> s/use/that uses/
<flip214> gin: you can have (BLOCK nil ..... (return nil))
<flip214> RETURN is a shorthand for RETURN-FROM NIL
<mfiano> I wouldn't rely on that, if "..." had some macro implicitly also defining a "closer" NIL block
<flip214> mfiano: well, the macro should warn about that (in the docstring, for example)
<mfiano> I would prefer
<mfiano> (block #1=#:nil ... (return-from #1# nil))
<mfiano> But that's just me
<beach> mfiano: Then you might as well do (block #1=#.(gensym)...)
<mfiano> I have no desire for a gensym
<mfiano> Just a freshly allocated symbol that is not identical to any other
<beach> I guess yours works if there is no other reference to the label.
<beach> Sure.
<flip214> mfiano: you can'
<flip214> mfiano: you can't run individual subforms in there, as the #1# definition must be visible.
<flip214> ie. with forms like (+ 1 (* 3 4)) during debugging/testing I sometimes only evaluate inner forms (like "(* 3 4)"), your example would produce a reader error
<mfiano> Err, what?
<hayley> Such an expression probably would only signal an error if there is a RETURN to an unknown block name.
cosimone` has joined #commonlisp
<Nilby> It's too bad that to fix this little wart one would have to add at least 2 more confusing operators: (defun hi () (block hi (return-from hi nil)) (print 'hi))
cosimone has quit [Remote host closed the connection]
<Nilby> or silly options to return or return-from?
<Nilby> maybe one could add a return-from-defun or something
iamFIREcracker has quit [Ping timeout: 245 seconds]
iamFIREcracker has joined #commonlisp
<jackdaniel> Nilby: defun most likely expands to (setf (fdefinition hi) (lambda () (block hi …))) so unless you want to impose a specific expansion from defun you can't tell whether the function is defined with defun or otherwise
Inline has joined #commonlisp
<jackdaniel> s/most likely/could/
<jackdaniel> if you could guarantee that each function exapnds to (lambda () (block some-internal-symbol …)) then escaping from the innermost function would be trivially (return-from some-internal-symbol …)
<Nilby> Yes, defun would have to be unfortunately more complex.
<jackdaniel> the complexity increase would be minute, but good luck convincing all implementers to add such feature with a limited usefulness
<Nilby> Yes, there are so many more important issues.
wilfred has quit [Quit: Connection closed for inactivity]
hendursa1 has joined #commonlisp
hendursaga has quit [Ping timeout: 276 seconds]
flip214 has quit [Read error: Connection reset by peer]
flip214 has joined #commonlisp
<Nilby> I don't know why I'm still midly amused at RMS being the single NO on many CL committee votes. elisp seesm to embody them. https://gist.github.com/agumonkey/777c2a289aa3afc2d814b38adbf5da9b#file-cl-history-txt-L2492
notzmv has joined #commonlisp
tfb has joined #commonlisp
<Cymew> I wonder if you are seeing something different than me, because I don't see that. He does abstain (which is what I guess - means) uitq often, but he does not vote N more often than anyone else.
<Cymew> s/uitq/quite/
<Nilby> Cymew: Maybe I'm thinking of a different document I read, where I think he was opposed to lexical scope and keyword arguments.
iamFIREc1 has joined #commonlisp
selwyn has joined #commonlisp
iamFIREcracker has quit [Ping timeout: 245 seconds]
attila_lendvai has joined #commonlisp
cosimone` has quit [Quit: ERC (IRC client for Emacs 27.1)]
cosimone has joined #commonlisp
loskutak has joined #commonlisp
<lisp123> Nilby: Thanks for sharing that link
CrashTestDummy2 has joined #commonlisp
CrashTestDummy has quit [Ping timeout: 250 seconds]
<Cymew> It was an interesting document, though.
loskutak has quit [Ping timeout: 245 seconds]
<Cymew> What I find interesting is that RMS and someone else mentioned they were opposed to a change where they would have to find all instances of a construct in old code and change it, and I at once though of a bash loop over a file tree using sed.
<Nilby> I find it helpful to see why things are they way they are and thought, debate, and other paths considered. There must be other copies of it, but that's what I could easily find.
<Nilby> Cymew: bash wasn't done until seven years later in 1989 :)
<jackdaniel> "so to morph elisp to common lisp I've written bash, but then I've run out of steam" -- Bash Secret Files
<Cymew> Yeah, but looping over files and manipulating them was done in 1983, in lisp. ;)
<Cymew> Sorry, my math was off, but you get the point.
<Nilby> and now I have a shell and sed in CL, so I can do both
<Cymew> I think I've seen KMP argue convincingly why keyword arguments are bad, but now we have them.
<Nilby> at the same time
<Cymew> :)
* Nilby is unconvinced
<gin> Cymew: who is KMP? any article I can read about why keyword arguments are bad?
<Cymew> Kent Pitman
<Nilby> I love the keyword arguments, and wish they were in elisp too. They're not perfect, but they enable amazing compatibility.
<Cymew> I just have a vague recollection of it, but most things written by Pitman on lisp is worth your time.
<gin> I like keyword arguments too because the keywords act like self-documentation for the arguments.
taiju has quit [Ping timeout: 245 seconds]
<Cymew> Yeah, I disagree with RMS on those as well.
<lisp123> jackdaniel: Is that true?
<jackdaniel> lisp123: of course not
<lisp123> oh lol
<jackdaniel> still, I like think of my silly remarks as witty (or at least funny)
<lisp123> I was going to edit awesome-cl-list and include bash as originating from CL :D
<Nilby> very few copies of "Bash Secret Files" have been leaked
<lisp123> Cymew: I used to love keyword arguments but I have been moving against them lately
makomo_ has quit [Ping timeout: 245 seconds]
<lisp123> Do you have a link to the article?
iamFIREcracker has joined #commonlisp
taiju has joined #commonlisp
iamFIREc1 has quit [Ping timeout: 245 seconds]
<Cymew> I can't find any bigger works by KMP on keywords, so maybe I misremembered or is was on usenet.
<lisp123> No worries, will have a look myself too
<gin> lisp123: why do you not like keyword arguments anymore?
<beach> I was about to ask the same question.
<lisp123> gin: I'll put it the other way, what are the main benefits of keyword arguments?
<gin> lisp123: flexibility in apis in future, function calls are easier to read because the keyword argument tells what the argument means
<beach> Reasonable defaults, shorter function-call forms in the general case, extensible interfaces.
<beach> Possibility for "intermediate functions" to ignore arguments irrelevant to them.
Mandus_ has quit [Ping timeout: 268 seconds]
<lisp123> flexibility in apis I agree with
<beach> Possibility for :AROUND methods to supply specific versions of keyword arguments without knowing about all of them.
<lisp123> My issue has been towards the reasonable defaults
<lisp123> Feels like that is embedding assumptions into the parameter list (lambda list?)
<beach> More readable function-call forms.
<_death> defaults are part of the interface (and should therefore be documented)
<beach> Instead of (f t t nil 234 11 nil t t #\a), you get (f :from-end t :remove-duplicates t...)
Mandus_ has joined #commonlisp
<lisp123> beach: what if one creates a separate function (f2 t t) for that use case
<beach> lisp123: You will have an exponential number of functions then.
<lisp123> Fair point
<beach> (defun f-with-from-end-true-and-remove-duplicates-true-as-well...)
<_death> bare "t"s are a pet peeve
<beach> (defun f-with-from-end-true-and-remove-duplicates-false...)
<beach> etc.
<_death> imagine a better world, where encode-universal-time took keywords
<lisp123> what if instead that information was passed in via an argument (e.g. (f arg1 arg2) --> arg1 is a class with various components, then in the body of f, you check if certain propertiers are met
<beach> lisp123: For one thing, you would then allocate memory for each call.
Mandus_ has quit [Ping timeout: 245 seconds]
Mandus_ has joined #commonlisp
<beach> lisp123: And you would turn every function call into the creation of a standard object (or at least a struct), with the battery of initialization that is then required.
<_death> lisp123: and how would you create an instance of this class?
<beach> lisp123: I am not sure where you pick up all these strange ideas.
<_death> (let ((instance (create-foo))) #| long list of setfs |# ...) ?
<beach> And there would have to be a SETF for each slot, since we don't like defaults.
<lisp123> I don't think its that strange. Right now, a keyword argument with a default value has an implicit if statement (if supplied use-arg otherwise-use-default), making it explicit within the body of the function and then passing in those details via an argument, even if inefficient, doesn't sound strange
<lisp123> By not supplying a keyword argument, there is an implicit assumption to use the default, so my thought was whether this should be made explicit
<lisp123> Given sometimes the issues &key has when used in macros etc.
<beach> Er, what?
<_death> lisp123: the compiler can often eliminate these IFs (the procedure can have multiple entry points)
<tfb> It just means that instead of letting the language do the work for you you need to do it all yourself rather than relying on CL's very nicely designed keyword-argument system
<beach> tfb: Exactly, and in doing so, defeating all the compiler optimizations adapted to the language.
<lisp123> _death: Yes
<_death> it's true that macros should use &key with care, to preserve order of evaluation (usually by help of an additional &rest arg)
<Nilby> The supplied-p-parameter can let you make more explict decisions.
<beach> The fact that it is hard to get the semantics right with writing macros seems like a weak reason for eliminating keyword arguments everywhere.
<lisp123> Not to eliminate, but to be judicious in their use
<lisp123> I think any external-facing API definitely benefits greatly from them
<lisp123> And in certain cases (many casees?) what you just said makes perfect sense
<jackdaniel> lisp123: highly optimized internal functions rarely use keywords indeed
<_death> you can see elisp for an example of rejection of keyword arguments.. where many functions have a bunch of optional parameters, and you need to pass arguments up to the ones you're actually interested in
<jackdaniel> so there is nothing to solve, just to discover the contemporary style
<jackdaniel> :)
<lisp123> But I think sometimes it can be a shortcut and its better to write out the code more explicit (I think I've written some bad code that relies on keyword arguments, so that's where its coming from)
<beach> jackdaniel: But that's probably because they couldn't figure out a way to get rid of the argument parsing.
<beach> lisp123: That's what I meant by strange ideas. You seem to make an isolated observation and then you draw very broad conclusions from it.
<jackdaniel> beach: probably; or they could but getting rid of the argument parsing introduces some minimal overhead to allow that
<beach> lisp123: A better idea would be to give some more thought as to the reason for the isolated case being bad, and just make a much more narrow conclusion.
<jackdaniel> either way keyword arguments are in the standard for good and they are really nice for various uses
sm2n_ is now known as sm2n
<lisp123> beach: Well, all I said was "I used to love keyword arguments but I have been moving against them lately", I never said they are categorically bad or anything ;)
<beach> The common use case: (defmethod mumble :around (... &rest args &key foo) (apply #'call-next-method :foo <altered> args)) is fantastic.
<beach> lisp123: Got it.
<sm2n> I like what s7 scheme does, which is that they got rid of keyword arguments, kept optional ones, and let refer to the optional ones with keywords at a callsite
<sm2n> s/let/let you/
<sm2n> basically merging the two
<jackdaniel> I think that scheme doesn't have clear function redefinition semantics so they wouldn't care much about redefined argument lists - do I miss something?
<_death> what happens if you want to pass a keyword as the value?
Mandus_ has quit [Ping timeout: 245 seconds]
<beach> Good catch!
<sm2n> you have to do it as a pair with the argument name, unless you :allow-other-keys
Mandus_ has joined #commonlisp
<sm2n> that's a good point though, it's kind of confusing in the latter case, I didn't know that could work
<sm2n> jackdaniel, I'm not sure how that is related
<sm2n> https://ccrma.stanford.edu/software/snd/snd/s7.html#define* see the note about error checks here
<jackdaniel> sm2n: (defun xxx (foo &optional a b c) …) (defun yyy () (xxx 42 :b 13)) (defun xxx () (foo &optional b a c) …)
<jackdaniel> the order of optional arguments changed
<jackdaniel> so if it has been "preprocessed" when yyy was defined, and then xxx is redefined, then yyy's :b 13 will be essentially :a 13 (because a is now the second optional parameter)
<sm2n> oh, I see
<sm2n> that makes sense
<sm2n> I was wondering if there would be something that would make it hard to compile when I saw it, and I guess I was right
Mandus_ has quit [Ping timeout: 265 seconds]
tfb has quit [Quit: died]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
Mandus_ has joined #commonlisp
random-nick has joined #commonlisp
cosimone has quit [Ping timeout: 265 seconds]
flip214 is now known as flip768
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
makomo_ has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
Mandus_ has quit [Ping timeout: 245 seconds]
Inline has quit [Ping timeout: 265 seconds]
Mandus_ has joined #commonlisp
heisig has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
Mandus_ has quit [Ping timeout: 245 seconds]
Mandus_ has joined #commonlisp
amb007 has joined #commonlisp
frgo has quit [Remote host closed the connection]
frgo has joined #commonlisp
Inline has joined #commonlisp
Mandus_ has quit [Ping timeout: 265 seconds]
Mandus_ has joined #commonlisp
Lord_of_Life has joined #commonlisp
loskutak has joined #commonlisp
Mandus_ has quit [Ping timeout: 265 seconds]
<gin> do you use LOOP in all its glory? LOOP feels like its own DSL. anything wrong with using just plain (loop (something) (something) ... (when cond (return))?
<hayley> (loop collecting complaints-about-loop)
<hayley> But, really, it's too much of a hassle to write a macro which collects values into a list, without PUSHing each value and calling REVERSE.
<gin> didn't know there was collecting clause. what's the difference collecting and collect?
<hayley> Nothing.
pranavats has left #commonlisp [Disconnected: Replaced by new connection]
pranavats has joined #commonlisp
Mandus_ has joined #commonlisp
<gin> both these lists appear the same in REPL: (defparameter *a* (list 1 2 3)) (defparameter *b* '(1 2 3)). is there some way to print in different ways so that I know which one was created using LIST and which one was created as a literal?
<hayley> I don't believe there's any way you can tell them apart.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
cranium has joined #commonlisp
<gin> is there any naming convention to separate internal functions from exposed functions?
tyson2 has joined #commonlisp
Lord_of_Life has quit [Quit: Laa shay'a waqi'un moutlaq bale kouloun moumkine]
frgo has quit [Remote host closed the connection]
<hayley> But, a "counter-example" to that idea: how would you print (cons 4 (rest *b*))?
<hayley> The package system?
<gin> hayley: good point. hadn't thought about such cases if we need to tell literal list apart from constructed list.
specbot has quit [Remote host closed the connection]
minion has quit [Remote host closed the connection]
specbot has joined #commonlisp
minion has joined #commonlisp
<jackdaniel> you may compare forms with (constantp '(list 1 2 3)) vs (constantp '(quote 1 2 3)) ; but this doesn't have much utility for runtime data
<jackdaniel> (quote (1 2 3)) °
Everything has quit [Ping timeout: 268 seconds]
Everything has joined #commonlisp
kpoeck has joined #commonlisp
Jach has joined #commonlisp
jackdaniel has quit [Remote host closed the connection]
jackdaniel has joined #commonlisp
srhm has quit [Read error: Connection reset by peer]
srhm has joined #commonlisp
Krystof has joined #commonlisp
frgo has joined #commonlisp
mrSpec is now known as spec
spec has quit [Quit: ZNC - http://znc.in]
mrSpec has joined #commonlisp
mrSpec has quit [Client Quit]
spec has joined #commonlisp
frgo has quit [Remote host closed the connection]
frgo has joined #commonlisp
frgo has quit [Remote host closed the connection]
frgo has joined #commonlisp
Psybur has joined #commonlisp
<gin> need help with this - https://plaster.tymoon.eu/view/2661#2661 - in my code each COLLECT returns a list, so I get a list of lists in the end. is there a way to merge all the lists from collect into a single list?
<beach> Use APPEND instead of COLLECT on the outer level.
<hayley> Use APPEND instead of COLLECT
<gin> wow! thanks
frgo has quit [Ping timeout: 265 seconds]
Bike has joined #commonlisp
<gin> so LOOP really is powerful. still cannot shake off that feeling that I am using something non-Lispy while using LOOP features.
<beach> How can something that is part of the Lisp standard be "non-Lispy"?
<hayley> Names name me (and my programming style) not.
<gin> poor choice of words by me. I mean for so long I was used to the (verb arg1 arg2 arg3) syntax but with LOOP the syntax changes very much that I feel like I am learning a new language.
<hayley> "This is true of me: no concept expresses me, nothing that is said to be my essence exhausts me; they are only names." But I an still inclined to agree with beach.
<beach> gin: You are learning a DSL and that's fine.
<gin> ok. will keep practicing.
random-nick has quit [Ping timeout: 245 seconds]
<gin> hayley: where you got that quote from?
<hayley> Then it should be strange for DEFUN, DESTRUCTURING-BIND, RESTART-CASE, and so on to have more "syntax". But LOOP is notably lacking in parens.
<hayley> gin: The Unique and Its Property
<flip768> gin: you can use ITERATE, that's nearly like LOOP only with parens.
NeoCron has joined #commonlisp
<beach> I refuse to define "Lispy" as "must have parentheses".
<hayley> Say, in (defun f (x) x) the (x) does not represent a function call, rather it is a lambda list. I think beach called these additional grammars a "two level syntax" or something like that.
<beach> That term was invented by Paul Wilson.
<hayley> Noted.
<gin> beach: how would you define "Lispy" if you were to define it?
<hayley> Otherwise, it seems normal to me to introduce new grammar to Lisp. A macro I wrote has "infix" arrows like (chain (x <- some-effect) (y = (f x)) (list x y)) but it isn't "un-Lispy" to me.
<beach> gin: Dynamic (i.e. semantics defined by a suite of interaction), dynamically typed, using uniform reference semantics, homoiconic, and very likely more.
<edgar-rft> hayley: it were more Lispy if the arrow would like like (- instead of <-
<gin> hayley, beach, thanks for sharing your views on this. helps me to appreciate the underlying ideas that I otherwise dont think about
<beach> Sure.
<hayley> edgar-rft: Maybe I should use the Unicode left arrow character instead of <-. People have compose keys these days, no?
cage has joined #commonlisp
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
frgo has joined #commonlisp
<jackdaniel> I don't think that being lispy is as much about parenthesis but loop semantics are not crystal clear (because it is a complex dsl); format is also very complex
ec has joined #commonlisp
frgo_ has joined #commonlisp
<jackdaniel> I don't think that any syntax that could be implemented as dsl in lisp is "lispy" by definition
<jackdaniel> uh, so many "I don't think that", I'll keep quiet ,P
<jackdaniel> that said both loop and format are widely used by lisp programmers, so they could be considered "lispy" for that reason alone
frgo has quit [Ping timeout: 265 seconds]
Josh_2 has joined #commonlisp
<aeth> LOOP is not easily handled by Lisp tools (even a fully configured Emacs+SLIME with the LOOP additions doesn't properly indent more advanced LOOPs), which suggets that it probably has gone too far as far as the non-Lispiness DSLs go
<beach> Nah, that just suggests that Emacs+SLIME are not as great as they could be.
<beach> Or, rather, not as great as a preferred tool should be.
<aeth> I mean, if supporting your DSL is harder than supporting the rest of the language combined when a few extra parentheses in the design could have avoided that whole issue...
<aeth> but, unfortunately, ITERATE is not just "LOOP with parens" no matter how many times people say it, so I use LOOP, not ITERATE
<beach> Well, the entire technique used by Emacs+SLIME is mediocre for Lisp. Not just LOOP indentation.
tyson2 has joined #commonlisp
Lord_of_Life has joined #commonlisp
<ahlk> Are there any tools that use a better technique than Emacs+Slime do for Lisp?
Nilby has quit [Ping timeout: 245 seconds]
<beach> ahlk: Maybe the IDE of Lispworks. But we are working on better tools. It's a bit slow though.
frgo_ has quit [Remote host closed the connection]
frgo has joined #commonlisp
azimut_ has joined #commonlisp
azimut has quit [Ping timeout: 276 seconds]
waleee has joined #commonlisp
<lisp123> The Emacs IDE is pretty advanced but requires a lot of customisation to get it where you want. Which can get trying at times
<beach> I think it's the best we have, but it's pretty bad.
<beach> Indentation does not work properly. Syntax highlighting and completion does not take symbol roles into account. etc., etc.
<lisp123> All true
<beach> To see syntax errors, you have to issue an explicit command (C-c C-c for instance) whereas it would be much better to see them as they happen when you type.
Lord_of_Life has quit [Quit: Laa shay'a waqi'un moutlaq bale kouloun moumkine]
<lisp123> I guess Emacs is too slow for that
<lisp123> I get stack overflows pretty frequently for any type of live (on buffer change) functions
rain3 has joined #commonlisp
<beach> It is possible that Emacs could keep up, but since the entire IDE is based on transmitting bytes between Emacs and the Lisp image, either you need to transmit lots of bytes for each character you type, or you need a very sophisticated (read complicated) communication protocol.
kevingal has joined #commonlisp
<lisp123> Yes
<lisp123> What is holding Climacs back from production use?
<lisp123> (Production being define as the basic features of SLIME & Emacs, excluding all the packages)
<lisp123> Once the basics are up, the rest can follow if mass adoption is reached
<beach> Available time for me and some others like scymtym.
<beach> But then, if you create an IDE that runs in the same image as your Common Lisp implementation, you have to deal with the fact that the Common Lisp implementations available to us are way too easy to crash, so then you crash your IDE as well.
<beach> The main issue for Second Climacs is indentation. I still have to figure out how to compute it.
<lisp123> So currently the editor will crash if the main image crashes?
<beach> If they both run in the same image, then obviously yes.
<beach> I mean, if the editor runs in the application image, then yes.
<lisp123> Hmmm, not possible to have a main editor image and an inferior image or will that lose the benefit of information sharing between the editor & the user's image?
<beach> How would the two communicate? You would be back to bytes being transmitted between the two.
<lisp123> Yeah, was hoping there was some magic :)
<Bike> maybe you could do something funny with shared memory.
<beach> Possibly.
<lisp123> I had a look at Emacs indentation before, but I guess you don't want to port their indentation as a starting point
<beach> lisp123: Emacs indentation sucks, which is why I want something better.
<beach> lisp123: (first) Climacs indentation is already better than that of Emacs in many respects, but it is horribly complicated, and still doesn't work in the general case.
<lisp123> I might have a look later at it, I wrote (what I thought were) some nice parsers which could help attack the problem
<beach> lisp123: The only true parser for Common Lisp code is READ. So unless that is what you use, it is not going to work right.
<beach> That is why Emacs and (first) Climacs indentation doesn't work in the general case.
Lord_of_Life has joined #commonlisp
Lord_of_Life has joined #commonlisp
Lord_of_Life has quit [Changing host]
<lisp123> I wrote a parser that looks n tokens ahead and behind to calculate how to treat words (sorry if my terminology is off), then it has multiple passes, so one solves for the unambiguous case to begin, and then one uses defaults for the ambiguous cases
<lisp123> Each pass resolves more ambiguity (because certain words can be parsed for certain based on previous results)
igemnace has quit [Quit: WeeChat 3.3]
<beach> lisp123: Let me give you a simple example. Suppose you have (<some-operator> (let ((x 10))<newline> (+ x 10))), how do you indent (+ x 10)?
<beach> lisp123: It is possible that <some-operator> is a macro so that (let ...) is not a form but data. How does your parser determine that situation?
patrice has joined #commonlisp
<lisp123> How would you like it to look?
<lisp123> (if you have a pastebin)
<beach> Probably, the (+ x 10) should be aligned with the symbol LET.
<beach> But only if it is not a form.
<beach> If it is a form, it should be indented as a LET would normally be indented.
Lord_of_Life has quit [Quit: Laa shay'a waqi'un moutlaq bale kouloun moumkine]
<lisp123> Ok
<beach> And, which one it is, is determined by <some-operator>. If it is a function or a macro that expands it into a position of evaluation, then it should be indented as a LET form. Otherwise not.
<beach> So my question is, how do you determine the difference in your parser?
<lisp123> One of the starting points would be to loop through each token and see what it is
<beach> The only way I can see how to do it, is to run it through READ and then the first pass of a compiler-like tool.
<lisp123> Yes exactly
<lisp123> So one would map it to a macro then
<dieggsy> ....never forget your time zones lol. I just spent way too long chasing down an off by one day date conversion cause i'm a fool
<beach> So if you say "exactly" and your parser doesn't use READ, I don't see how you resolve that conflict.
<lisp123> No, it should use READ & a code-walker as a starting point
<lisp123> Then over multiple passes one resolves ambiguity
<beach> That's precisely what we are doing.
<lisp123> and resorts to defaults where it can't be resolved
<beach> But I don't think that is what your current parser is doing, at least not judging from your description of it.
<lisp123> Mine is not a lisp parser, its an english to math parser
<lisp123> But the concept was nice --> multiple passes, looking ahead & behind, resolving certain words at each pass
<beach> So I spent all this time thinking you are parsing Common Lisp. Oh, well. Back to work.
<lisp123> Sorry
<gin> A: (sort some-list (lambda (x y) (...))) B: (sort some-list #'(lambda (x y) (...))) <- is one considered to be better style than the other?
cranium has quit [Quit: Leaving]
<beach> The first one is better.
<gin> to be fair, i too thought this was a common lisp parsing discussion. when did it become english parsing discussion and how is indentation relevant in english parsing?
<lisp123> The algorithm for parsing can be applied anywhere
<beach> lisp123: Yes, but it won't work for Common Lisp code.
<beach> Because it doesn't use READ.
<gin> beach: thanks! I use the first style but got confused by looking at the examples at http://www.lispworks.com/documentation/lw51/CLHS/Body/f_sort_.htm
<lisp123> Well, an algorithm parses based on certan rules --> read is used for classification of tokens
<beach> gin: The examples have not been scrutinized. Sometimes they are not even conforming.
<gin> ok
lottaquestions has joined #commonlisp
<lisp123> A lisp expression is just a finite (nested) list of tokens at the end of the day
<lisp123> So there needs to be a table of the indentation rules based on the patterns, READ & associated functions to assist with classifications, and a general algorithm which does the parsing
<beach> lisp123: Most parsers have a fixed set of rules, but READ can be altered by user code anytime. So for instance if you have (<some-operator> #.<code-that-modifies-the-read-table> ...) then you need to alter the parser rules for ...
<beach> lisp123: I give up. You don't seem to get it. Sorry.
<lisp123> Yes, but at any point in time you have the state of the image
<lisp123> If that changes in the next time step, then you can (in theory) reparse the whole document
<gin> no offence intended but i think it is a good time to end the parsing discussion. when one party has indicated that they don't want to continue it is good to end the topic cordially.
<lisp123> Sure
lisp123 has quit [Quit: Leaving...]
amb007 has quit [Ping timeout: 245 seconds]
srhm has quit [Read error: Connection reset by peer]
srhm has joined #commonlisp
kpoeck has quit [Quit: Client closed]
_patrice has joined #commonlisp
Devon has joined #commonlisp
amb007 has joined #commonlisp
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
lottaquestions has quit [Ping timeout: 245 seconds]
tyson2 has joined #commonlisp
makomo_ has quit [Ping timeout: 265 seconds]
ggoes has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
ggoes has joined #commonlisp
selwyn has quit [Read error: Connection reset by peer]
Mandus_ has quit [Ping timeout: 265 seconds]
<waleee> Anyone else that has started to get weird build errors like https://0x0.st/-gIk.txt with sbcl master from git?
srhm has quit [Read error: Connection reset by peer]
Mandus_ has joined #commonlisp
srhm has joined #commonlisp
<gin> is one considered a better style than the other here: https://plaster.tymoon.eu/view/2662#2662 ? The first one has: if fancy collect this else collect that. The other has: collect (if fancy this that)
<beach> gin: The second is usually better. And it also works if you have something more complicated than IF, say for instance collect (let ((....)) (if ...))
<gin> beach: thanks
Catie has joined #commonlisp
<beach> On the other hand, if your collect is conditional, you must use the first one, or use an APPEND that sometimes returns the empty list.
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
<gin> ok
<_death> waleee: the commit responsible is from today.. might want to alert sbcl devs
<waleee> ok will pop in to #sbcl
Inline has quit [Ping timeout: 265 seconds]
Cymew has quit [Ping timeout: 265 seconds]
ec has quit [Ping timeout: 276 seconds]
tyson2 has joined #commonlisp
ec has joined #commonlisp
jealousmonk has joined #commonlisp
hendursa1 has quit [Ping timeout: 276 seconds]
amb007 has quit [Ping timeout: 265 seconds]
amb007 has joined #commonlisp
hendursaga has joined #commonlisp
amb007 has quit [Ping timeout: 245 seconds]
amb007 has joined #commonlisp
ec has quit [Ping timeout: 276 seconds]
<dieggsy> macros that evaluate a defun at macro expansion time rather than expand to a defun are kind of odd. is there a use case for this
<Josh_2> For functions used in macro generation?
<Josh_2> sorry functions that are used within macros
kpoeck has joined #commonlisp
kpoeck has quit [Quit: Client closed]
_dave has left #commonlisp [ERC (IRC client for Emacs 27.2)]
<dieggsy> Josh_2: oh, yeah, that'd be. yep. we just have an actual outward facing function being generated this way and i found it odd
ec has joined #commonlisp
Everything has quit [Quit: leaving]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<gin> for keeping a list of pair of delimiters what is a better data structure: '(("<" . ">") ("{" . "}") ("[" . "]")) or '(("<" ">") ("{" "}") ("[" "]"))? list of alists? or list of lists?
<Bike> what are you using it for?
JeromeLon has quit [Remote host closed the connection]
JeromeLon has joined #commonlisp
<Catie> gin: I would think the list of cons cells is more idiomatic, owing to the popularity of the (cdr (assoc ...)) construct
<gin> Bike: for checking balanced delimiters in a string
<pjb> dieggsy: there's no good use case for such a thing. use (eval-when (:compile-toplevel) (defun foo …)) to define functions usable at macro-expansion time.
<pjb> dieggsy: you can define local functions in macros with flet or labels.
<Bike> i guess conses seem fine. i don't see any reason to make them lists
<gin> thanks Bike, Catie
<dieggsy> pjb: well, they're doing both eval-when but also evaluating at expansion time.... it's. yeah. I'm gonna "if it aint broke don't fix it" but i won't follow that for my own use cases. not that i would have anyway lol. thanks
<pjb> Bike: the reason to make them list is to make it easier to write the literal.
<_death> gin: you can just use a string like "<>{}[]" and even/odd indices
<pjb> But then, you can just use a flat list: ("<" ">" "{" "}" "[" "]")
<pjb> or a string indeed.
<pjb> Sometimes, they are multi-char: ("(*" "*)" "<:" ":>" "<" ">" "{" "}" "[" "]")
<gin> _death: I thought about it but did not do it because then I would not be able to support multi-character delimiters. Like '(("{{" . "}}) ("<<" . ">>"))
<_death> a hash-table is another option
<pjb> Not easy to write a hash-table literal!
<_death> alexandria has plist-hash-table
<pjb> (loop for (left right) on '("<" ">" "{" "}" "[" "]") by #'cddr do (format t "~A yay ~A " left right)) #| < yay > { yay } [ yay ] --> nil |#
_patrice has quit [Quit: Leaving]
patrice__ has joined #commonlisp
<pjb> _death: that doesn't make it a literal. You'd need to add #. and ensure the hash-table literal has a load-form!
<_death> pjb: why do you need a literal
<Josh_2> gin: I think I would personally go with an alist
<pjb> gin: do you need a literal? Or is the bag mutable?
waleee has quit [Quit: WeeChat 3.3]
<gin> pjb: literal is fine because the list of delimiters is known in advance and can be hardcoded in the code as a literal
<gin> I like the idea of making it a flat list (no alist, no list of lists) and then looping over it with (loop for (left right) on delimiters) ...
<Catie> gin: You can treat it as a plist and use getf with it in that case
waleee has joined #commonlisp
<_death> not really.. a plist means keys are symbols (that's also why alexandria:plist-hash-table isn't such a good name)
<Catie> _death: ah, you're right. my bad on that one
<pjb> Catie: getf uses eql so it wouldn't work well with strings, but you can write your own accessor, or use symbols.
<_death> getf uses EQ..
<pjb> (getf '(< > { } [ ] \( \)) '<) --> >
amb007 has quit [Read error: Connection reset by peer]
<pjb> right EQ
Inline has joined #commonlisp
amb007 has joined #commonlisp
ec has quit [Ping timeout: 276 seconds]
<Josh_2> An alist would also mean you can easily search by the cdr with rassoc
<Josh_2> lists are cool
<pjb> (loop for (left right) on '(< > { } [ ] \( \)) by #'cddr until (eq '} right) finally (return left)) -> {
<pjb> but indeed, alist are useful, when you want to be able to mutate an entry.
ec has joined #commonlisp
<Josh_2> Tbf if its a constant then you can probably use compiler macros to make things go zoom zoom
<pjb> Indeed.
charles_ has joined #commonlisp
srhm has quit [Quit: Konversation terminated!]
molson_ has joined #commonlisp
molson has quit [Ping timeout: 268 seconds]
cosimone has joined #commonlisp
selwyn has joined #commonlisp
selwyn has quit [Remote host closed the connection]
ec has quit [Ping timeout: 276 seconds]
selwyn has joined #commonlisp
ec has joined #commonlisp
kevingal has quit [Remote host closed the connection]
ec has quit [Ping timeout: 276 seconds]
<jeosol> Good morning guys.
<Josh_2> Mornin'
<jeosol> I am trying to test my local workflow on a simple, cheap and remote cloud instance. Those running CL in a cloud vendor, what do you recommend. I know it's depends, but I just want to run SBCL (only), that a server remote and send jobs to it
<jeosol> Second question: how might I start a repl remotely. I used ssh to test with my second box. Ideally, I want to run the command so it launches a repl remote and then I can send computations to it.
<Xach> jeosol: i was not very happy with connecting a local emacs to a remote sbcl. i could not always get tramp things working properly, and network delays were frustrating. i switched to using a remote emacs. a wide screen split vertically, plus xterm-mouse-mode, plus mosh, made it work pretty well for my purposes.
<Xach> also screen (some use tmux but i'm used to screen)
<Josh_2> I have a VPS with many local images that I can connect to with sly, I actively develop many of these applications as they are run and are in use
<Josh_2> I have all the source code on my own machine
<Josh_2> so I dont worry have to worry about tramp or delays. They are barely noticeable with sly
<Xach> Josh_2: interesting. stuff like M-. works without tramp when using sly?
<jeosol> Xach: Thanks for that input. I tried a long time ago, but could not get it to work then, but I wasn't an expert at those things. Network impacts is something I am trying to evaluate. I can perform the computation on a local box in same network here around 3 seconds
<Josh_2> Yes
<Josh_2> Just tried it
<Xach> Josh_2: i will have to revisit it sometime
<Josh_2> oh wait
<Josh_2> no I didn't try it sorry lemme go try it
<sm2n> hmm, reading http://clhs.lisp.se/Body/02_df.htm and it seems that it's implementation-defined whether backquote produces literal data or not?
<Josh_2> yes it does work on a remote image
<Josh_2> first time I was hacking on a local image :P
<Josh_2> C-c C-k does not work, you have to highlight the entire file then C-c C-c
<Josh_2> At that point though I normally just change the image
ec has joined #commonlisp
<etimmons> Do you compile the image locally? If not, do your source files have the same paths remotely and locally?
rain3 has quit [Ping timeout: 265 seconds]
<jeosol> etimmons: not sure if that was directed at me. But my for my use case, my two boxes I test on, everything matches. I don't edit files on second box though so as not to mess up git etc. I push from one machine to other (for computations only)
<etimmons> Sorry, was aimed at Josh_2
<jeosol> no worries
<Josh_2> etimmons: I compile locally and I do not have any source files on my remote machine
<etimmons> Ahhh, so I think that's why it works without Tramp
<etimmons> The paths compiled in the image are valid on your local machine
<Josh_2> My upload is pretty fast so only takes about 10 seconds to upload my 120mb sbcl image
<Josh_2> yeh
opcode has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 27.1]
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
lottaquestions has joined #commonlisp
<jmercouris> is there a way to specialize against nil?
<jmercouris> so I have (defmethod seeds ((tomato tomato))) for example
<jmercouris> can I also write (defmethod seeds ((empty nil))) ?
<Josh_2> Yes null
<_death> the class of nil is null
<jmercouris> OK
<jmercouris> that clears it up
<jmercouris> thank you
mgxm has quit [Quit: ....]
mgxm has joined #commonlisp
selwyn has quit [Ping timeout: 245 seconds]
ec has quit [Ping timeout: 276 seconds]
heisig has quit [Ping timeout: 265 seconds]
charles__ has joined #commonlisp
selwyn has joined #commonlisp
ec has joined #commonlisp
charles_ has quit [Ping timeout: 245 seconds]
tfeb has joined #commonlisp
tyson2 has joined #commonlisp
azimut_ has quit [Remote host closed the connection]
hendursaga has quit [Remote host closed the connection]
azimut has joined #commonlisp
hendursaga has joined #commonlisp
tfeb has quit [Quit: died]
random-nick has joined #commonlisp
gaqwas has joined #commonlisp
ec has quit [Ping timeout: 276 seconds]
<Psybur> Lets say I want to create a hash set of lists, and the order of elements in the list do not matter. How should I go about this? I dont see a way to specify a hash function for make-hash-table
ec has joined #commonlisp
<_death> you can have the key be the list in a canonical order
<Psybur> sort is giving me issues heh, i was thinking it would be easier to figure out a clever hash function than figure out why my code only works when I use sort combined with copy-list heh
terrorjack has joined #commonlisp
lottaquestions has quit [Quit: Konversation terminated!]
<Bike> sort destroys lists. that's why
<_death> a hash function is insufficient, you also need an equality operator in case of collisions
lottaquestions has joined #commonlisp
<Psybur> Bike, I know, and Im trying to use dynamic variables in my recursive calls to avoid copy-list but its still inefficient
<Psybur> *insufficient
<Psybur> Basically finding all unique depth first paths in a tree, where order of nodes doesnt matter
<Psybur> Creating the path, then when I hit null, sort it and put it in a hashtable. I was able to get my alg working for small datasets of the problem, now trying to improve performance as i scale
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
makomo_ has joined #commonlisp
<_death> in any case, at least SBCL's make-hash-table supports user-defined test/hash functions.. (documentation 'make-hash-table 'function)
<Psybur> Ah I didnt think to see if sbcl had some special sauce. Nice
<_death> it seems strange to me that you talk about "scale" here.. what is the path length with big datasets?
<_death> and why do you think that'll be a bottleneck
<Psybur> Actually, this part of the problem might not even be the bottleneck youre right heh
makomo_ has quit [Quit: WeeChat 3.2]
raeda has joined #commonlisp
<Psybur> Actually I think it is the bottleneck, the part where I make all possible paths finishes quick
ec has quit [Ping timeout: 276 seconds]
contrapunctus has left #commonlisp [#commonlisp]
<mfiano> A "hash set" is a nested hash table, with the inner table having self-evaluating keys
<Psybur> Yeah Ive got that worked out, now just trying to see how sbcl implements its hash function for lists, wondering if I have to override just :test or both the hash function and :test
<_death> it's better to just use a 2d array there
ec has joined #commonlisp
<mfiano> Psybur: the hash function is not an option in standard CL
<mfiano> You would need a portability library for that
taiju has quit [Remote host closed the connection]
contrapunctus has joined #commonlisp
taiju has joined #commonlisp
Lord_of_Life has joined #commonlisp
Lord_of_Life has quit [Read error: Connection reset by peer]
Lord_of_Life has joined #commonlisp
shka has quit [Ping timeout: 245 seconds]
<jmercouris> let's say I print an object, and I get something like #<DEMETER::RSS-FEED {100BC74913}>
<jmercouris> is there ANY WAY to inspect that object?
<jmercouris> it is not highlighted red in slime
<jmercouris> but surely I can do something with the 100BC74913?
<Josh_2> slynk-mrepl:copy-to-repl-in-emacs ?
<Josh_2> Or break and copy it manually
<jmercouris> maybe
<mfiano> That requires the user to edit their Emacs configuration, since it is a security hazard
<Josh_2> Sure but you can setq it in scratch just for that session
<mfiano> They didn't specify if they were writing a library
<mfiano> or an application
<Josh_2> Ima guess that jmercouris is hacking on nyxt
<White_Flame> jmercouris: you can set a variable to that object instead of printing it, then it should be more "live"
<White_Flame> and if you need a series of values, push to a variable
<mfiano> Then their best option is Clouseau
<jmercouris> I guess I could set a variable
<White_Flame> also, no you can't do anything with the 100BC74913 reliably, as GC might have happened in the meantime and moved it
<jmercouris> yeah, I'll probably push to a list
<jmercouris> thanks for the input
<White_Flame> another option, since this likely isn't a return value, is setting a breakpoint
<White_Flame> especially as you can surround that break with conditionals
<mfiano> If you BREAK after printing, the debugger should have a stack frame that you can click on the local rss feed object
<mfiano> print may not even be necessary, if the object is already a local
<pjb> jmercouris: (inspect (print object0)
<pjb> jmercouris: (inspect (print object))
<pjb> jmercouris: you can walk all the data that you can access, until you find an object that prints with the same identifier. Then you could assume it's the same object.
<pjb> jmercouris: however, a general solution to this problem is not possible, if you don't have the source of all the code you've loaded in the image: there's no standard way to walk the slots of a structure.
<jmercouris> I have the source...!
makomo has quit [Ping timeout: 265 seconds]
<pjb> Then with the source, you can loop over the accessors of structures.
Lord_of_Life_ has joined #commonlisp
<Josh_2> I have 8 packages or so that have a few conflicting external symbols, however in every case the conflicting symbol is a method, whats the best way to resolve this?
Lord_of_Life has quit [Ping timeout: 245 seconds]
Lord_of_Life_ is now known as Lord_of_Life
<mfiano> By not using :USE
<mfiano> That is a code smell in my opinion. Use PLNs
<Josh_2> PLN?
<mfiano> package-local nicknames extension
<Josh_2> I see
<Josh_2> Obviously I just want to use :use, that was my design intention considering its just a bunch of API calls
pve has quit [Quit: leaving]
pve has joined #commonlisp
pve has quit [Client Quit]
<mfiano> That is really a bad style.
ec has quit [Ping timeout: 276 seconds]
<mfiano> Ignoring your issue, it also makes code much harder to understand, and code is read much more often than it is written.
<mfiano> I actually refuse to read code that uses :USE
<mfiano> (besides (:use :cl))
<copec> I actually only picked up on that point like six months ago with my own stuff
<copec> lone programmers are slow on the up-take :-P
<Josh_2> well why would I want to go through an manually import every function and method that are just a bunch of API calls?
<mfiano> You don't import anything
<copec> Use the package:symbol
<etimmons> Speaking of PLN, anyone know if there's been an attempt to get it into CMUCL?
<Josh_2> Well I could use the package:symbol but I am trying to just create a single package that contains all of the API calls which are each divided into their own packages
ec has joined #commonlisp
<mfiano> That is orthogonal
<Josh_2> So the user (me) would just import from that one package rather than the 10 various packages
<mfiano> Still orthogonal
<Josh_2> Yeh still full of right angles
<copec> (It's the same issue whether importing or using pln's)
<copec> you use pln's in your one package to rule them all, and you use pln's in the packages that use that
<Josh_2> alright
<Josh_2> i'll look into pln
<copec> also, pln maps external package to internal nickname, so it makes it easier to swap dependencies
<mfiano> Yes
<jmercouris> I have a function that writes to a stream, is there a handy little macro I can use to write that stream to a string?
<jmercouris> read-stream-content-into-string
<jmercouris> finally remembered
<mfiano> (alexandria:read-stream-content-into-string)
<mfiano> yes
ec has quit [Ping timeout: 276 seconds]
<mfiano> By the way, can I get any of you Lispers to partake in this little experiment? https://www.reddit.com/r/lisp/comments/q2esnh/share_your_bookshelfves/?
<Josh_2> get-output-stream-string ?
NeoCron has quit [Quit: Leaving]
NeoCron has joined #commonlisp
<Josh_2> mfiano: not a chance I'm gonna do that
<mfiano> That's fine. Not everyone has a nice library.
<jmercouris> Ay yai yai 11
<copec> mfiano, are you @lukego? I'm @copecog, my bookshelves are packed up because I had to move my office out to move another room in so that another room can be reconstructed from flooding
<copec> heh
<mfiano> copec: No
<mfiano> But that's unfortunate. Take your time, the thread might still be active when you can
<jmercouris> I give up for now, cl prevalence is not doing so well for me today
<Josh_2> I have a nice library :smirk: lots of lisp books
abrantesasf has joined #commonlisp
patrice has quit [Ping timeout: 245 seconds]
<Psybur> Dang, even after realizing I can ignore paths where the next element is < the current one, and not even have to deduplicate paths this way, its taking forever to walk all the paths
dec0d3r has joined #commonlisp
patrice__ has quit [Quit: Leaving]
random-nick has quit [Ping timeout: 245 seconds]
tyson2 has joined #commonlisp
loskutak has quit [Ping timeout: 265 seconds]
frgo has quit [Remote host closed the connection]
frgo has joined #commonlisp
<_death> Psybur: for what it's worth, I used a 2d array containing hash-tables, and a canonical key
<Psybur> _death, I actually just figured out a way without having to worry about keeping track of paths, I figured out some optimizations you can use by sorting the coin denominations and not having to use lesser denominations when starting with higher ones
<Psybur> It can find 7 billion combos in under a second now
<_death> no doubt there are more sophisticated ways to solve it
igemnace has joined #commonlisp
NeoCron has quit [Quit: Leaving]
akoana has joined #commonlisp
<Psybur> Took me a day to figure out the skipping lesser coins optimization heh (make-change remain (remove-if (lambda (x) (< x coin)) values))
<mfiano> Psybur: You should _never_ define a special variable without earmufs.
<mfiano> The consequences could be disastrous, since a lexical variable cannot shadow a special variable.
<Psybur> Ah crap whoops, yeah I usually remember to add **, I realize I forgot with the first 2 vars
<Psybur> I remembered after that heh
<mfiano> Also all of those globals are needless, since they are state consumed by a single function and don't even need to be passed around
<mfiano> At the very least, use a closure
<mfiano> global variables that aren't used as dynamic variables make it hard to understand a program
<Psybur> Got it
<_death> I remember SICP had this problem btw
<mfiano> Otherwise, good work. I see this is your first CL repository, so congrats
<mfiano> I don't have time to make any algorithm-specific comments
<mfiano> _death: Too many/useless globals? I actually never read that
<_death> Example: Counting change
<mfiano> Oh
<mfiano> I know some other Lisp book had it as well. Not sure if it was PCL of Clojure for the Brave and True
<mfiano> s/of/or/
<Psybur> I found this problem by searching for dynamic programming problems on hacker rank, and checking if there was a CL environment for the problem
<Psybur> The way the book handles denominations is pretty confusing. I think its easier to think of it as a list. But the way they did it as a function is probably more efficient
<Psybur> Solving DP problems is giving me nightmares of my CS course in college heh The teacher had an auto grader and you got 3 tries to get it right or you got a 0 for the assignment
<Psybur> I almost got a 0 for the capstone of the coding assignments for the whole program, some DP problem involving maze traversal. Had to be coded in C++. Good times.
<_death> right, it would have been clearer to have it as a list in descending order.. then you'd just have (defun cc (amount coins) (cond ((= amount 0) 1) ((or (< amount 0) (null coins)) 0) (t (+ (cc amount (rest coins)) (cc (- amount (car coins)) coins)))))
<_death> btw your solution seems to differ, (make-change 100 '(50 25 10 5 1)) => 40749
attila_lendvai has quit [Ping timeout: 265 seconds]
<Psybur> hmm it passed the tests on the site, ill check this case out
<_death> good luck.. sleepytime
<Psybur> _death, did you try with the coins in asc order?
<Psybur> My alg depends on that
<copec> mfiano, The thing I'm finding myself do more is just to incorporate the alias package into the naming scheme, but I'm not sure how to. For instance, I wrote a package that does basic sets
<copec> If I have set-p in the package, and I use a pln so it is just set, then when I use set:set-p it makes me want to rename it to something so it looks nice
<copec> for instance I have set:union set:symm-diff etc.
<copec> set:-p
<copec> heh
<copec> set:being-p
Catie has quit [Quit: rcirc on GNU Emacs 27.2]
<Xach> copec: did you see the HTML generation library with a package name of <?
<Xach> and functions like p>, ul>, etc.
<mfiano> copec: I find that pretty foolish. PLNs are local to the package consuming the API. They can differ between your package and a user's package. Additionally, that would make renaming packages very tedious.
<Xach> (maybe it was macros or syntax, but the trick was stuff like <:p>, <:b>, etc.
<Xach> ))))
<copec> ^That's funny
<Xach> i also smiled at the function with a full symbol name of (iso:8859 ...)
<Psybur> _death, I get 292. My code reads from stdin then sorts the denoms, then calls the make-change function with it.
<copec> mfiano, I assume the internal name is going to remain the same, that if I were to change the package name I would just change the :local-nicknames
taiju has quit [Ping timeout: 245 seconds]
<copec> Which library is it Xach? My search skills are failing me
<mfiano> My point was an operator name should be self-documenting. THe PLN "SET" may already be used by the user, and so they would now have to either update all their 'set:' prefices so they can use 'set:' for your API, or choose something else. The former is more work to adopt your work. The latter may not be more readable, and code should always be readable.
<mfiano> This is just my (probably unpopular) opinion, though.