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>
s-liao has joined #commonlisp
<Guest74> so maybe not as easy as I thought.
CodeBitCookie[m] has joined #commonlisp
s-liao has quit [Quit: Client closed]
s-liao has joined #commonlisp
<Guest74> mister_m: There has to be an easier way. It's a three line loop if you don't care about adding elements or removing lists. 4 to remove lists that are less than count. And this mess is what I got for everything. https://plaster.tymoon.eu/view/2769#2769
<rotateq> ":when (not (null current))" <- ":unless (null current)"
<rotateq> hm is the nested "setf current" by intention?
<Guest74> nested? if you mean the new lines it's so it doesn't run off the screen. I choose when or unless based on which I think reads better.
<rotateq> no because of your form in symbol-macrolet above
<Bike> as in, after macroexpansion this will be like (setf current (typecase leftover ... (cons (setf current ...))))
<rotateq> yes that
<Guest74> it's definitely not pretty.
<Guest74> oh I see.
<Guest74> an error that doesn't cause errors.
<rotateq> and beware, even when current is an empty vector NULL will return NIL
<Guest74> though never happens here.
jstoddard has quit [Quit: ERC (IRC client for Emacs 27.2)]
<rotateq> that's no reason to let it be this way :)
<Guest74> You propose I change something for something that will never happen?
<Guest74> what do you propose?
<rotateq> that this is no argument for it when you just think be "seeing" that it shall never happen. things are also by reading intention
<Guest74> what do you proose
<Guest74> propose
<rotateq> i can always put more to it which "can never happen"
<Guest74> what do you propose? or how do you see it happening?
<rotateq> by reading your lines
Guest74 has quit [Remote host closed the connection]
Guest74 has joined #commonlisp
<Guest74> What do you propose as a solution. Can you give an example of how this would happen?
<rotateq> i didn't say it's about anything that could happen, just the intention you give to your readers
<Guest74> so what is the intention I'm giving with that according to you?
<rotateq> and no, i don't even have until now the right specification of what should clearly be done by the elixir thing
<rotateq> *sigh*
<Bike> http://ix.io/3Hxy here's my take
<Bike> kind of fiddly
<rotateq> that while you cover lists and vectors it wouldn't handle just lists right
<rotateq> ah you set the &optional different
<Guest74> ah, class-of! I was wondering how to get just vector and not vector some length
<Bike> i guess interiorp doesn't need to be its own variable
<Guest74> I kinda cheated on :discard
<Guest74> i like default of step as count as well.
<Bike> that's what the elixir page says, right?
VincentV` has quit [Remote host closed the connection]
<Guest74> oops. I just looked at the examples.
<Guest74> ...and I don't know elixir.
<Bike> me neither
<Guest74> I should have got it from looking at the examples though. they have without step.
<Guest74> I think you're missing collecting just the short chunk if I'm reading yours correctly.
raeda has joined #commonlisp
akoana has joined #commonlisp
Oladon has joined #commonlisp
Catie has quit [Quit: going home]
random-nick_ has quit [Ping timeout: 252 seconds]
winning-luser has quit [Remote host closed the connection]
<Bike> it works with all the examples on the elixir page, at least
<Bike> (chunk '(1 2 3 4) 3 3 ()) => ((1 2 3) (4))
<Guest74> well, I think I've already established I don't read very well :)
<Guest74> ah, i see now.
<Guest74> I think I used nil because I don't like typing empty lists. but that makes the code so much easier.
poselyqualityles has joined #commonlisp
Algernon69 has joined #commonlisp
Oladon has quit [Quit: Leaving.]
Algernon69 has quit [Read error: Connection reset by peer]
Bike has quit [Quit: Lost terminal]
robin has joined #commonlisp
Algernon69 has joined #commonlisp
gaqwas has quit [Ping timeout: 265 seconds]
gaqwas has joined #commonlisp
Algernon69 has quit [Remote host closed the connection]
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #commonlisp
anxt has joined #commonlisp
<beach> Good morning everyone!
<fe[nl]ix> hey beach
dec0d3r has joined #commonlisp
semz has quit [Ping timeout: 265 seconds]
tyson2 has quit [Remote host closed the connection]
semz has joined #commonlisp
poselyqualityles has quit [Ping timeout: 260 seconds]
kakuhen has quit [Remote host closed the connection]
Oladon has joined #commonlisp
dec0d3r has quit [Quit: Leaving]
lisp123 has joined #commonlisp
<lisp123> Has the idea of (slightly after) compile-time determination of generic-function calls to the relevant specialised method been thought of in the past?
aartaka has joined #commonlisp
Alfr has quit [Quit: Leaving]
<lisp123> In the event new classes are not added after compiliation, then each function call could be fully determined right after compile time? And if that is correct, then one could inline the actual methods vs. runtime determination
<lisp123> Perhaps have like a marker for particular functions to say "hey dont worry about classes created at runtime, just inline these at compile time"
<Nilby> Most things in CL, including CLOS, was designed with the idea and possibility that a "sufficiently smart compiler" could make it fast. So yeah. Not that it always works out.
<lisp123> I see. So a compiler already does something similar
<lisp123> That would make sense. Until a new class is created during runtime, you can use the old specialisations and avoid having to recheck
<Nilby> Compilers are allowed to inline things where they can, which is why all those redefinition warnings can actually be useful, becuase if the other uses aren't recompiled it could be using the old inline version.
<edgar-rft> Classes still an be re-defined and inheritance order still can be changed, both at run-time.
MichaelRaskin has quit [Quit: MichaelRaskin]
<lisp123> Makes sense!
edgar-rft has quit [Quit: Leaving]
elderK has quit [Quit: Connection closed for inactivity]
aartaka has quit [Ping timeout: 260 seconds]
<beach> lisp123: Yes, one idea is "sealing" as heisig explains in his paper on fast generic functions.
<beach> lisp123: Another idea is to alter the call site in some way when the generic function changes.
<hayley> lisp123: Are you thinking of (polymorphic) inline caching?
<beach> lisp123: You can look at my paper on call-site optimization for the latter.
<hayley> An inline cache avoids performing a full lookup almost all of the time, and still permits redefinition by "emptying" the caches.
<lisp123> beach: Thanks! I will read these. I read bits of http://metamodular.com/SICL/generic-dispatch.pdf, but to be honest I skimmed to the unique number bit so maybe missed other parts
<lisp123> Is it a different paper?
<beach> Yes. Hold on...
<beach> First entry: http://metamodular.com/SICL/
<beach> Nilby: What does the standard say about inlining generic functions? I would be surprised if it were allowed to inline a generic function in the state it is in when the caller is compiled.
<lisp123> hayley: I was looking at Swift which basically copied many of CL's ideas and renamed them. But instead of mixins, they would inline the code directly by synthesising the different components
s-liao has quit [Ping timeout: 256 seconds]
* hayley waits for Swift to copy tracing garbage collection and multiple dispatch. Oh wait.
<lisp123> beach: Thanks!
<hayley> But "mixins" are a design strategy, and inlining is a compilation strategy. You could still program using mixins, if the compiler inlined everything.
<beach> lisp123: I don't know Swift, but is it a dynamic programming language, by which I mean a language where the semantics are defined by a sequence of interactions in a global environment?
<lisp123> hayley: Seriously, they go out of their way to rename things when its clear they took inspiration from CL. Blatant plagiarising, but then they hide a lot of their details so its a complete mess anyway
<hayley> You might want to read <https://bibliography.selflanguage.org/_static/pics.pdf> on polymorphic inline caches.
<lisp123> beach: No, not at all. All compiled
<beach> lisp123: I am not talking compiled vs interpreted.
<hayley> That is again an impedance mismatch.
<beach> I am talking static vs dynamic.
<hayley> Swift is defined by a set of source files, i.e. static.
<beach> lisp123: In a static language, you have none of the problems you have in a dynamic language with adding methods at run time.
<lisp123> Yes, static
<beach> lisp123: A programming language is neither compiled nor interpreted.
<beach> lisp123: That's an implementation strategy. You can compile Perl and interpret C.
<lisp123> beach: So I was wondering the value of giving people the option to specify certain methods not to be superceded by other methods defined at run time
<beach> lisp123: It can have a great impact on performance, as heisig's technique takes advantage of.
<lisp123> beach: Nice! Well time for me to shut up and read :)
<beach> However, heisig is now convinced that my technique for call-site optimization will largely supersede his technique.
<beach> So a "programming language" is a specification that determines the syntax and semantics of conforming programs as well as the result of some non-conforming programs.
<lisp123> beach: Thanks, I need to remind myself to be more precise on the terminology
Alfr has joined #commonlisp
aartaka has joined #commonlisp
Devon has quit [Ping timeout: 265 seconds]
notzmv has quit [Ping timeout: 252 seconds]
Cymew has joined #commonlisp
phantomics has quit [Remote host closed the connection]
Cymew has quit [Ping timeout: 260 seconds]
Algernon69 has joined #commonlisp
Cymew has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
davep has quit [Quit: Connection closed for inactivity]
Oladon has quit [Quit: Leaving.]
lisp123 has joined #commonlisp
treflip has joined #commonlisp
makomo has quit [Ping timeout: 240 seconds]
waleee has joined #commonlisp
_whitelogger has joined #commonlisp
x88x88x has quit [Remote host closed the connection]
x88x88x has joined #commonlisp
<jackdaniel> lisp123: restricting certain objects to not be modified is known as "sealing"
<jackdaniel> it is not part of the common lisp standard, but some implementations offer such functionality
<jackdaniel> although it is not commonly used
<jackdaniel> (afaik)
x88x88x has quit [Remote host closed the connection]
x88x88x has joined #commonlisp
OlCe has quit [Remote host closed the connection]
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
edgar-rft has joined #commonlisp
edgar-rft has quit [Client Quit]
pdietz has quit [Quit: Client closed]
s-liao has joined #commonlisp
gaqwas has quit [Ping timeout: 260 seconds]
rain3 has joined #commonlisp
Algernon69 has quit [Ping timeout: 260 seconds]
OlCe has joined #commonlisp
Algernon69 has joined #commonlisp
notzmv has joined #commonlisp
jpl01 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
attila_lendvai has joined #commonlisp
rain3 has quit [Ping timeout: 268 seconds]
akoana has quit [Quit: leaving]
shka has joined #commonlisp
cage has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
<lisp123> jackdaniel: Thanks, good to know the term
Algernon69 has quit [Ping timeout: 250 seconds]
Algernon69 has joined #commonlisp
Algernon91 has joined #commonlisp
Algernon69 has quit [Ping timeout: 250 seconds]
cosimone has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 256 seconds]
Lord_of_Life has joined #commonlisp
<rotateq> lisp123: iirc one can define a compiler-macro for a generic-function too if it makes sense
<rotateq> okay, even it makes not much sense ^^
Algernon91 has quit [Ping timeout: 240 seconds]
s-liao has quit [Ping timeout: 256 seconds]
s-liao has joined #commonlisp
karlosz has joined #commonlisp
s-liao has quit [Quit: Ping timeout (120 seconds)]
s-liao has joined #commonlisp
cage has quit [Remote host closed the connection]
cage has joined #commonlisp
* rotateq learnt right now that SETF can also be called on a values form
<lisp123> rotateq: That's a nice idea!
<lisp123> beach: I finished reading http://metamodular.com/SICL/call-site-optimization.pdf , very enjoyable - thanks for writing
<beach> Glad you like it.
igemnace has quit [Remote host closed the connection]
lisp123 has quit [Remote host closed the connection]
s-liao has quit [Ping timeout: 256 seconds]
VincentVega has joined #commonlisp
rain3 has joined #commonlisp
knobo has joined #commonlisp
OlCe has quit [Ping timeout: 250 seconds]
rain3 has quit [Ping timeout: 250 seconds]
rain3 has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
rain3 has quit [Remote host closed the connection]
pdietz has joined #commonlisp
mrvdb has joined #commonlisp
attila_lendvai has quit [Ping timeout: 252 seconds]
OlCe` has joined #commonlisp
ghard has joined #commonlisp
karlosz has quit [Quit: karlosz]
OlCe` has quit []
OlCe has joined #commonlisp
abrantesasf has joined #commonlisp
random-nick_ has joined #commonlisp
Jing has joined #commonlisp
phantomics has joined #commonlisp
s-liao has joined #commonlisp
knobo has quit [Quit: Client closed]
tyson2 has joined #commonlisp
hhdave has quit [Ping timeout: 240 seconds]
hhdave has joined #commonlisp
s-liao has quit [Quit: Client closed]
s-liao has joined #commonlisp
pdietz has quit [Quit: Client closed]
pranavats has joined #commonlisp
* pl had a possibly stupid idea for a bit of reader hack with comments
<pl> namely, modify readtable to turn all line and block comments into forms, then shadow block forms to let those forms record their contents *somewhere* and make it accessible akin to documentation slot on a symbol
<beach> Welcome to Eclector. We already read non-form material.
<yitzi> beach: Beat me to it!
<pl> beach: would it be usable from, let's say, normal SBCL code?
<beach> Eclector? Sure, I use it from SBCL every day. That's how SICL code is read for bootstrapping.
<beach> Not with comments and such though.
<beach> But we do that in Second Climacs.
<beach> Using SBCL.
<Nilby> ;; TODO: Revise this comment after implementing comment capture.
<rotateq> ;; COMMENT: This is a comment.
attila_lendvai has joined #commonlisp
<rotateq> i wonder why github thinks five files of the climacs 2 repo are with NewLisp
igemnace has joined #commonlisp
<jackdaniel> because it is such modern style that it can't be called anything but new
<rotateq> nice
perrierjouet has quit [Quit: WeeChat 3.3]
rgherdt_ has joined #commonlisp
perrierjouet has joined #commonlisp
rgherdt has quit [Ping timeout: 240 seconds]
cosimone` has joined #commonlisp
cosimone has quit [Quit: ERC (IRC client for Emacs 27.1)]
Alfr has quit [Killed (strontium.libera.chat (Nickname regained by services))]
Alfr has joined #commonlisp
rgherdt_ is now known as rgherdt
xsperry has quit [Remote host closed the connection]
<yitzi> rotateq: It happens on my repos too sometimes. I have use the gitattributes file to override the linguist settings.
Algernon69 has joined #commonlisp
Algernon91 has joined #commonlisp
<rotateq> the future is already there
pdietz has joined #commonlisp
<jackdaniel> should structure slots in defstruct should be matched with string= (not with eql) for sake of avoiding conflicts in /structure-name/-accessor and :accessor-initarg ? I think so
<jackdaniel> and if yes - is it specified in the standard? if not - is it a good candidate for wscl?
<pdietz> As I recall, the standard doesn't say exactly which package the various constructed symbols go into.
anxt has quit [Quit: Leaving]
<jackdaniel> so the third option would be interning /structure-name/-accessor in the symbol home-package?
Algernon69 has quit [Ping timeout: 268 seconds]
<rotateq> i learned this week by trying out that (string= 'foo :foo) => T, as (format nil "~a ~a" 'foo :foo) => "FOO FOO", if the keyword should really print as such the "~s" directive is useful
<pdietz> Oops,. no, it does specify.
<rotateq> a where does it so?
<pdietz> It goes into the package that is the value of the *PACKAGE* variable at the time the defstruct form is expanded.
<pdietz> clhs defstruct
<pdietz> and search for "package"
<jackdaniel> good, one moving part less :)
pve has joined #commonlisp
abrantesasf has quit [Remote host closed the connection]
abrantesasf has joined #commonlisp
<rotateq> i'm still not sure what a correct way is to transform a symbol from normal (quoted) to its keyword form, 'foo <- :foo. (read-from-string (concatenate 'string ":" "FOO")) maybe? cause with INTERN it returns it with pipes
<rotateq> or hm maybe a better question for #clschool
<jackdaniel> (intern (symbol-name 'foo) "KEYWORD")
<jackdaniel> or (intern "FOO" "KEYWORD")
OlCe has quit [Remote host closed the connection]
<rotateq> ah now that you say it, INTERN has this optional parameter ^^
<jackdaniel> you probably did (intern "foo" "KEYWORD")
<jackdaniel> pipes are just the printer hinting you that symbols are case sensitive and your symbol name does not match the printer case (so probably it is not what you really wanted)
<jackdaniel> there are no "symbols with pipes" :)
<rotateq> no i tried additionally (intern (concatenate 'string ":" "FOO")) => |:FOO| and this surely can't be equal to :foo under EQ
<jackdaniel> ah, that's what you mean, I see
<jackdaniel> you've used ":" as part of the symbol name
<rotateq> yes :)
<pdietz> You should never call INTERN without specifying the package explicitly.  It's a code smell to depend on *PACKAGE* there.
<rotateq> okay so good that i get that now better
<rotateq> pdietz: that's a good tip for from now on
<rotateq> ah now with (inspect :foo) it gets clearer why string= return T. the same name, but another special package
<dbotton> is there some convention of expressing, even if just a matter of documentation, what the expected return value of a function will be?
<pdietz> STRING= and similar functions take string designators as arguments, not strings.   String designators can be symbols (which designate their symbol-name) and characters (which designate the string of length 1 containing that character).
<jackdaniel> dbotton: i.e (declare (values string))
<pdietz> VALUES is not a standard declaration specifier.
<rotateq> yeah wondered me too
<rotateq> and thx pdietz, this with the string designators i learned some months ago from here too :)
Bike has joined #commonlisp
<pdietz> And it is not valid type specifier either.
<pdietz> clhs values
<pdietz> "The symbol values is not valid as a type specifier; and, specifically, it is not an abbreviation for (values)."
<rotateq> dbotton: you could write #+(or)(declaim (ftype (function * type-of-return-value) the-function-symbol)) or so ^^
<rotateq> dbotton: or using really THE in the end
abrantesasf has quit [Read error: Connection reset by peer]
Jing has quit [Remote host closed the connection]
<jackdaniel> pdietz: I standa corrected, thanks :)
<jackdaniel> (proclaim (declaration values))
Jing has joined #commonlisp
abrantesasf has joined #commonlisp
abrantesasf has quit [Remote host closed the connection]
utis has quit [Ping timeout: 252 seconds]
utis has joined #commonlisp
<dbotton> THE looks like it may work for my intent (just need simple way to document return values), I do some experiments. Thank you
<jackdaniel> probably the best place is the documentation (i.e not the code)
<dbotton> although constraining the code is not a bad idea at all
<dbotton> I want to tell user and even compiler the potential return values
<rotateq> i don't know how much eg SBCL can benefit from using THE appropriately
<rotateq> but when you're sure it can also be useful for shipping intention to the reader
OlCe has joined #commonlisp
<jackdaniel> sbcl won't trust your the on default optimization settings, you need sb-ext:truly-the for that ;)
<jackdaniel> and if your declaration happens to be incorrect you may have interesting results at runtime
<rotateq> oh good to know, i try sticking that somewhere into my head for the next time
s-liao has quit [Quit: Client closed]
<jackdaniel> s/your the/your THE/
VincentVega has quit [Remote host closed the connection]
Jing has quit [Remote host closed the connection]
Jing has joined #commonlisp
<rotateq> even just how many additional sb-* packages brings SBCL with it still overwhelmes me
xsperry has joined #commonlisp
<pdietz> I found a real use for the DECLARATION declaration.   https://github.com/pfdietz/disable-inline
<jackdaniel> is this really enough for cover? the implementation may inline without any declarations
<jackdaniel> you'd need to proclaim notinline for each function
<pdietz> COVER works even w. inlining, since it alters the source s-expr during macroexpansion.
<pdietz> Where COVER has problems is with code walkers.
<pdietz> I had to hack both it and ITERATE to get them to work together.
random-nick_ has quit [Ping timeout: 256 seconds]
euandreh has quit [Ping timeout: 252 seconds]
euandreh has joined #commonlisp
aeth has quit [Ping timeout: 265 seconds]
aeth has joined #commonlisp
_73 has quit [Remote host closed the connection]
<jcowan> heisig's paper on fast generic functions: URL?
aeth has quit [Ping timeout: 268 seconds]
<jackdaniel> yes (/me puts "zjarany zdzicho" meme)
aeth has joined #commonlisp
<jackdaniel> it is for sealable metaobjects, fast generic function dispatch is a beach idea
<jackdaniel> s/is a/is/
<beach> Not quite. heisig created the library "fast generic functions".
<jackdaniel> right, it is covered in this presentation
<jackdaniel> thanks for the correction
<beach> Sure.
abrantesasf has joined #commonlisp
VincentVega has joined #commonlisp
edgar-rft has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
VincentV` has joined #commonlisp
VincentVega has quit [Ping timeout: 252 seconds]
aeth has quit [Ping timeout: 252 seconds]
cosimone` has quit [Ping timeout: 250 seconds]
cosimone` has joined #commonlisp
aeth has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
treflip has quit [Quit: good night ✨]
makomo has joined #commonlisp
cosimone` has quit [Ping timeout: 268 seconds]
Guest74 has quit [Ping timeout: 256 seconds]
abrantesasf has quit [Remote host closed the connection]
Cymew has quit [Ping timeout: 250 seconds]
Catie has joined #commonlisp
rain3 has joined #commonlisp
lisp123 has joined #commonlisp
Inline has quit [Ping timeout: 252 seconds]
jstoddard has joined #commonlisp
tyson2 has joined #commonlisp
cage has quit [Ping timeout: 240 seconds]
_73 has joined #commonlisp
_73 has quit [Remote host closed the connection]
nature has joined #commonlisp
cage has joined #commonlisp
<lisp123> When do lists outshine arrays? Is it in creating new lists by using CONS or something similar? Is there any other area where they are better
<Bike> pretty much the ease of putting new elements on the front is the main thing, yeah
<Bike> there's also structural sharing, i guess, but circular lists aren't super commonly used
<rotateq> being the structure for the code itself :)
<Bike> you can imagine using vectors for that
<rotateq> i could maybe ^^
<lisp123> Bike: Thanks, hmm so I guess not much else
<Bike> wikipedia has a detailed table comparing alternatives in its "linked list" article
<rotateq> isn't that enough?
<lisp123> I am thinking maybe I should just write an "array-list" "array-car" "array-cdr" etc. functions for use where I am not creating my own lists on the fly but rather just accessing them
<Bike> well, cdr is also nontrivial with arrays
<lisp123> Yeah, I need to think about how its done and figure out how this row-major-aref works
<lisp123> Gets a bit confusing when thinking about how the dimensions works
<lisp123> rotateq: We could implement VISP ;)
<lisp123> or VECP
<rotateq> ah pff :D way to unnatural
<rotateq> lisp123: i see lists way more flexible and that you can implement most other data structures potentially in an elegant way
<lisp123> They are very flexible / enjoyable to use
<lisp123> that is true
<lisp123> Is there like a number of elements, where lists are quite efficient vs. arrays? Say 5 elements
<_death> (defun vcons (x y) (vector x y)) (defun vcar (vcons) (aref vcons 0)) (defun vcdr (vcons) (aref vcons 1)) ;; todo: add support for vnil
<rotateq> or next time when someone praises turing machines too much, ask about how to have it recursive :D
<Bike> lisp123: doubtful, if you mean efficient in read access
<Bike> getting the head element will pretty much be one memory read either way, and for anything past that the list has to do more reads
<Bike> did a quick test and getting the third element of a list is (very slightly) slower on sbcl already
<lisp123> _death: Thanks :) Copied / pasted already into my lisp code :D
<lisp123> Bike: Interesting, that's very early in the cycle that vectors are more efficient. I was also thinking in terms of space storage, but is it fair to say that generally read access is the more important consideration?
<lisp123> (this is all assuming no requirement to add elements to the data structure)
<Bike> lisp123: lists are also going to do worse in space storage, since you have N conses and each cons has two fields
<rotateq> _death: the vcons i would expect working a bit different, that eg 1 consed to #(2 3) produces #(1 2 3)
<lisp123> :o
<jackdaniel> array-cdr - perhaps consing a displaced array
<lisp123> No more lists for me, then. Farewell friend :'(
varjag has joined #commonlisp
<rotateq> okay the thing with displacing arrays and how and when i didn't understand till now
<rotateq> lisp123: and why not?
tyson2 has quit [Remote host closed the connection]
<_death> rotateq: the point is that it's not lists, it's conses.. like Bike said, the point of "lists" (built from conses and nil) is structure sharing and the related fact that it's a recursive structure
<rotateq> yes, don't get me wrong, your fast provided solutions/analogies are great :)
<jackdaniel> rotateq: I've written about conformal displacement on my blog some time ago - that would be quite convenient
<rotateq> jackdaniel: how was the url again? i have been there some times
<jackdaniel> lists are convenient for representing environments, because front elements naturally shadow things down the line
mzan has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
<jackdaniel> turtleware.ee
<_death> the problem with using a displaced array is that it conses ;).. the problem with vcons is that it's inefficient, a cons is an efficient two-element array
<jackdaniel> eu*
* jackdaniel is on phone
<jackdaniel> cons is also convenient for trees
mzan has joined #commonlisp
<jackdaniel> and shared structure is pretty necessary fir some algorithms
<jackdaniel> for*
<jackdaniel> no need to shy away from cons when convenient :)
mzan has quit [Client Quit]
<rotateq> ah right, jeeez rick
<_death> I was also reminded of https://adeht.org/usenet-gems/on-cons.txt
mzan has joined #commonlisp
amb007 has quit [Ping timeout: 260 seconds]
amb007 has joined #commonlisp
Oladon has joined #commonlisp
Algernon91 has quit [Ping timeout: 268 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<lisp123> full URL
<rotateq> thank you
karlosz has joined #commonlisp
<rotateq> think the last post of yours i partially read was about not needed backends with McCLIM
<lisp123> _death: Thanks for the link, will read. I still don't get the structure sharing & recursive structure benefits of lists, but I just have to think about it some more.
karlosz has quit [Client Quit]
<_death> if you have PG's ANSI Common Lisp he talks about these properties at length there
<lisp123> I do actually, thanks for the pointer, will read that too
<rotateq> oh noez, pointers attack
<_death> maclisp also had efficient arrays specialized for other sizes, by the way.. they were called HUNKs and you can read about them in the Pitmanual http://www.maclisp.info/pitmanual/
<VincentV`> What's the best way to define a macro with an optional argument like here: (name [optional qualifier] (var1 var2) &body)? sbcl's defmethod does (name &rest), so I guess I am out of luck, but I thought I would ask anyhow.
<Bike> my #1 piece of advice is don't do that. failing that, manual parsing like defmethod is all you got
<VincentV`> Bike: well, I thought about defining a second * macro, but there may be more qualifiers down the line. But, yeah, looks like rest it is
<rotateq> jackdaniel: i like the dynamic coloring feature in code blocks at your blog
<Bike> VincentV`: i mean you can change the syntax slightly to (name (&rest qualifiers) (var1 var2) . body)
<Bike> means an extra (), but then you don't need to parse anything
<VincentV`> Bike: yeah, I thought about that, that's also an interesting option I guess
<_death> probably the biggest annoyance would be arglist completion.. swank-arglists has some extensibility, but I remember it could use some improvement
<VincentV`> arglist completion is actually all that bothers me, I don't mind parsing
xantoz has quit [Ping timeout: 265 seconds]
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
<jcowan> In particular, records in MacLisp were built on top of HUNKS (whose sizes were always a power of 2)
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
lisp123 has quit [Remote host closed the connection]
nature has quit [Read error: Connection reset by peer]
Alfr has quit [Remote host closed the connection]
thomaslewis has joined #commonlisp
Alfr has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
tyson2 has joined #commonlisp
thomaslewis has joined #commonlisp
<jackdaniel> rotateq: people often like these - the css is modified an existing theme in coleslaw
<jackdaniel> aU've stooped using them because I've decided for myself that they are distractung (and not really useful -only shiny)
thomaslewis has left #commonlisp [#commonlisp]
lisp123 has joined #commonlisp
<lisp123> I read ANSI Common Lisp and thought a bit more. Now I understand the value of shared structures & the recursive definition of lists better
rain3 has quit [Ping timeout: 268 seconds]
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
random-nick_ has joined #commonlisp
lisp123 has quit [Quit: Leaving...]
tyson2 has quit [Remote host closed the connection]
thomaslewis has joined #commonlisp
varjag has quit [Ping timeout: 256 seconds]
thomaslewis has left #commonlisp [#commonlisp]
hobo has quit [Ping timeout: 252 seconds]
theothornhill has joined #commonlisp
theothornhill has quit [Remote host closed the connection]
theothornhill has joined #commonlisp
Oladon has quit [Quit: Leaving.]
Guest74 has joined #commonlisp
hobo has joined #commonlisp
lisp123 has joined #commonlisp
<lisp123> Does PRINT-OBJECT call MAKE-LOAD-FORM for user-defined classes?
<Bike> print-object does not call make-load-form (unless you define a method to i guess)
<Bike> why would it?
<lisp123> I'm just wondering how to implement PRINT-OBJECT for my own classes (not print-unreadable-object)
<lisp123> I just tried defining a method for MAKE-LOAD-FORM and got this error when trying to print-readably: ; Evaluation aborted on #<PRINT-NOT-READABLE {10016F1D93}>.
<pdietz> User defined objects do not have a readable printed form unless you define it.
<Bike> how exactly do you think print-object and make-load-form are related? they kind of aren't, generally.
<rotateq> (defmethod print-object ((object your-class) stream) ...) maybe?
<pdietz> (let ((*print-readably* t)) (print (make-instance 'foo))) ==> print-not-readable error
<Guest74> i think sbcl prints classes readably.
<Guest74> last time i checked years ago.
<pdietz> You define a method for print-object on your class, yes.  And it should check the value of *print-readably*.
<pdietz> SBCL does not.
<rotateq> it prints them with #<
<pdietz> That's the unreadable form printed when *print-readably* is nil.
<lisp123> Bike: Yeah, I'm just confused because I can't seem to find an example online on how to implement PRINT-OBJECT
<rotateq> lisp123: i wrote for you the beginning :)
<Guest74> I dunno, he keeps saying implement.
<rotateq> you could even dispatch on the stream class if needed
<Catie> Correct me if I'm wrong, but I think the hardest part is getting it to read back in properly and consistently. Aliasing, I'm pretty sure, is also a pretty big issue for serializing objects like that
<pdietz> I see 2557 occurrences of (defmethod print-object ... in the current quiklisp dist.
<Guest74> pdietz: seems I confused classes with hashes.
<Guest74> s/hashes/hashtables/
<lisp123> rotateq: Got it! It works. I reference a make-load-form within print-object
<lisp123> Thanks!
<pdietz> rotateq:  "In some implementations the stream argument passed to a print-object method is not the original stream, but is an intermediate stream that implements part of the printer. methods should therefore not depend on the identity of this stream."
azimut_ has quit [Ping timeout: 276 seconds]
tyson2 has joined #commonlisp
<lisp123> Catie: Yes, I agree. However, if I just stick to my own very small set of classes, then its straightforward. Abstracting for the general case is where the complexities come in I guess
<lisp123> This is what I did (defmethod print-object ((obj test) stream) (let ((*stream* stream)) (make-load-form obj)))
<_death> lisp123: if you want to print an object readably, you can use a reader macro.. look at defstruct, for example, which can print an instance as #S(foo :bar 42) .. another useful reader macro is #.
<Catie> lisp123: Okay same page, thank you! I was thinking too general, I think
<lisp123> _death: Yes, that's true. I have a few reader macros already, so I can leverage those. I'm just happy now that I'm using PRINT-OBJECT and not reinventing everything
<lisp123> Catie: Yes, I tried to write something general and gave up :)
<rotateq> pdietz: that's good to know again, i swear i never violated this rule before ^^
<lisp123> (my code above is incorrect, need to make *stream* a special variable, but one gets the point)
Inline has joined #commonlisp
varjag has joined #commonlisp
<_death> make-load-form has nothing to do with printing per se, but it's about letting CL know how to externalize objects so that they can be dumped in fasls and restored when the fasl is loaded
shka has quit [Ping timeout: 252 seconds]
<lisp123> That makes sense
<Guest74> can you use that for binary formatis?
azimut has joined #commonlisp
Inline has quit [Quit: Leaving]
Inline has joined #commonlisp
Inline has quit [Remote host closed the connection]
Inline has joined #commonlisp
<_death> it's not about encoding, more about preserving object equivalence possibly identity
<Guest74> ah, so can't really use it for space saving, the implementation just does it's own thing?
<_death> yeah, the contents of a compiled file are implementation dependent
<_death> that said, you could say wrap an array and have a make-load-form that recreates that array however you wish.. say by decompressing
<Guest74> haven't actually had an opportunity to play with that yet.
<Guest74> what's the secret formula to get emacs to stop inserting tabs? having to reformat pasted code is getting annoying.
<_death> (setq-default indent-tabs-mode nil) ?
<Guest74> that sounds like it, thanks.
<Guest74> although I'm guessing the first - belongs with default-inden...?
<_death> nope.. it sets the default value.. emacs supports buffer local variables
rogersm has joined #commonlisp
nature has joined #commonlisp
<Guest74> ok, thanks.
MichaelRaskin has joined #commonlisp
<VincentV`> Guest74: aggressive indent and never think about either tabs or spaces or formatting again
<VincentV`> btw does anyone know how do I match both type and assign the match to a variable? I am trying
<VincentV`> (trivia:match '(a :b c) ((list x (keyword y) z)))
<VincentV`>
<VincentV`> but that errors out NIL is undefined
<hayley> The first thing that comes to mind is (trivia:match ':a ((and x (type keyword)) ...))
VincentV` is now known as VincentVega
cage has quit [Quit: rcirc on GNU Emacs 27.1]
<VincentVega> hayley: cool, it works, I was doing by analogy with list and honestly wiki didn't help me much
<VincentVega> thanks
Oladon has joined #commonlisp
<Guest74> VincentVega: is that some emacs package? ...or a way of life?
lagash has quit [Ping timeout: 252 seconds]
rogersm has quit [Quit: Leaving...]
<VincentVega> Guest74: that's something you gotta find out for yourself... https://github.com/Malabarba/aggressive-indent-mode
Algernon91 has joined #commonlisp
<Guest74> meh, M-q is muscle memory now.
<VincentVega> Guest74: memory may fail you, but not aggressive indent
<VincentVega> Guest74: I will just say that it needs something like paredit along with it, it's all the way type of deal.
<lisp123> VincentVega: Is there any issues with aggressive indent or does it work perfectly always?
zardoz has joined #commonlisp
lisp123 has quit [Quit: Leaving...]
<VincentVega> lisp123: I haven't had any issues.
_73 has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
<_73> When I recompile my package (`sly-compile-and-load-file`), the special variable values do not get reset to their original value before I mutated them. How can I reset their values?
<Bike> use defparameter instead of defvar
<_73> ok I understand the problem now
Algernon666 has joined #commonlisp
attila_lendvai has quit [Ping timeout: 260 seconds]
Algernon91 has quit [Ping timeout: 250 seconds]
<_73> When would you use defvar instead of defparameter?
<Guest74> when you want to keep the values.
<hayley> You would use DEFVAR if you don't want the values of variables to be reset after re-evaluating DEFVAR forms.
<Bike> for example, when *foo* is an alist that you keep adding entries to
<_73> I see. It has to do with wanting the situation I was just confused about.
<Guest74> my window manager lives in a defvar
peterhil_ has joined #commonlisp
peterhil_ has quit [Remote host closed the connection]
peterhil has quit [Read error: Connection reset by peer]
lagash has joined #commonlisp
gaqwas has joined #commonlisp
notzmv has quit [Ping timeout: 260 seconds]
aartaka has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
Guest74 has quit [Quit: Connection closed]
pve has quit [Quit: leaving]
Devon has joined #commonlisp
varjag has quit [Ping timeout: 252 seconds]
elderK has joined #commonlisp
theothornhill has quit [Remote host closed the connection]
aartaka has quit [Ping timeout: 268 seconds]
notzmv has joined #commonlisp
random-nick_ has quit [Ping timeout: 250 seconds]
Algernon666 has quit [Ping timeout: 250 seconds]
lottaquestions has quit [Quit: Konversation terminated!]
<pjb> _73: I find their names are swapped, for historical reasons: I would use DEFPARAMETER to define global variables, (they are reset, when you reload the program), and DEFVAR to define program parameters (they're not reset when you reload the program).
<pjb> _73: now of course, program para
<pjb> -meters would have to be defined in a package different than the packages defined by the program, since those packages are not defined yet, when the program is not loaded yet.
kakuhen has joined #commonlisp
peterhil has joined #commonlisp
tyson2 has joined #commonlisp
<frodef> b
<hayley> b
Jing has quit [Remote host closed the connection]
Jing has joined #commonlisp
VincentVega has quit [Ping timeout: 252 seconds]