jackdaniel changed the topic of #commonlisp to: Common Lisp, the #1=(programmable . #1#) programming language | Wiki: <https://www.cliki.net> | IRC Logs: <https://irclog.tymoon.eu/libera/%23commonlisp> | Cookbook: <https://lispcookbook.github.io/cl-cookbook> | Pastebin: <https://plaster.tymoon.eu/>
jon_atack has joined #commonlisp
attila_lendvai has quit [Ping timeout: 255 seconds]
eddof13 has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hineios has quit [Read error: Connection reset by peer]
hineios has joined #commonlisp
random-nick has quit [Ping timeout: 265 seconds]
LW has quit [Quit: WeeChat 3.6]
pmwals09 has joined #commonlisp
akoana has quit [Quit: leaving]
igemnace has joined #commonlisp
Fare has joined #commonlisp
eddof13 has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 260 seconds]
Lord_of_Life has joined #commonlisp
eddof13 has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
pmwals09 has quit [Remote host closed the connection]
elderK has joined #commonlisp
<elderK> Hey guys, is there a way to "skip to the next iteration" using LOOP as with "continue" in C?
<elderK> :P I'm trying to do something with Loop and it's turning out kind of ugly.
<elderK> Just popping things off a queue while the loop may add new into the queue.
<elderK> So far, I'm using with and stuff but it looks pretty bad.
<patrix> https://lispcookbook.github.io/cl-cookbook/iteration.html might have something. Maybe conditionals will help?
<ixelp> Loop, iteration, mapping
<patrix> I don’t use loop often enough to know off the top of my head though
<nytpu> elderK: instead of doing the equivalent of `if X then continue` like in most languages, you can often do `when (not x)` before the body items of the loop
<elderK> Thank you!
<nytpu> for instance `(loop for i from 1 to 10 when (evenp i) do (format t "~a " i))` will print only even numbers, skipping the remainder of the loop items if the WHEN clause is false
<nytpu> sorry not the remainder of the loop items, it'll skip the remainder of the current iteration if the WHEN clause is false
Oladon has joined #commonlisp
<Bike> yeah, conventionally you just use conditionals. if you really want something more like "continue;" you can do it with tagbody/go, i.e. goto.
<elderK> Is there a guide on how we should format / indent our LOOP calls?
<elderK> As an example: https://pastebin.com/knJbCz2a
<ixelp> (defun direct-superclasses (name) (format t "get ~A~%" name) (case name - Pastebin.com
<elderK> I've been reading through TinyCLOS in Scheme and am translating parts of it to CL so I can better understand. I haven't written CL in a long, long time so I'm very rusty.
<elderK> My goal is to start using CL for all of my personal projects. I spend all day, every working day, dealing with C++ so a change would be nice :)
<Bike> i feel that.
occ has joined #commonlisp
<Bike> i usually just indent loop how slime with the fancy indentation does. which is i think what you have there.
<elderK> Cool: I'm using Vim and slimv as I have never learned how to use Emacs.
<elderK> You'd think it wouldn't be a big deal: Vim's just an editor but you know how it is. You get attached to your tools.
<Bike> slimv does the same, hopefully
<elderK> :( It formats them all at the same level.
<Bike> it's got 80% of the same letters after all
<Bike> oh, bummer
<elderK> I wonder if it would be possible to install and use Emacs only for indentation :P
<Bike> well, i'd say generally it's like that. conditional clauses get an indent. if you break one thing into multiple lines you indent that a little more (like "for x [newline] in y" stuff)
<elderK> Is there a cleaner way I could've done what I'm doing in the linked paste?
<elderK> Have to say I kind of miss named-let from Scheme. Perhaps I should implement it as a macro :)
<nytpu> elderK: in most cases you should indent how you think is sensible, you could indent flat or do the indentation you linked, or whatever. unless you're contributing to an existing codebase there's no rigorous style people expect you to follow
<nytpu> for iteration i personally prefer the for library over LOOP, but that's just personal preference: https://github.com/Shinmera/for
<ixelp> GitHub - Shinmera/for: An extensible iteration macro library.
<Bike> your code formatting looks fine to me. i don't remember if it's kosher to pop from a variable you're accumulating into, though.
<elderK> How can I learn if it's okay? I know that you're not allowed to mess with stuff that you're iterating over.
tyson2 has quit [Remote host closed the connection]
<Bike> look at the clhs, i guess. i don't see anything indicating it's not ok.
<Bike> clhs 6.1.3
<ixelp> CLHS: Section 6.1.3
mzan has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
mzan has joined #commonlisp
<nytpu> elderK, Bike: i believe the CLHS doesn't *require* that COLLECT clauses accumulate to the front of the list and then reverse it afterwards (although that's the only way to efficiently collect into a list), but since you're using APPEND and the PENDING list doesn't seem to be order-sensitive it shouldn't be an issue
<Bike> most implementations don't actually do the reverse afterwards thing. they just keep a pointer to the end of the list.
azimut has joined #commonlisp
<beach> As I recall, you can't do the reverse afterwards, because you may access the variable during iteration, at least for the use of INTO.
<beach> And, yes, you can mix COLLECT, APPEND, and NCONC.
<elderK> Thanks beach!
<beach> Sure.
bilegeek has quit [Quit: Leaving]
Fare has quit [Ping timeout: 255 seconds]
<nytpu> so since most CL impls don't do tail call optimization without high optimization levels, i was thinking about how you'd implement something like Scheme's named LET with manual TCO, and from what i can tell it'd be impossible without semantic analysis, right?
<nytpu> because `(* 1 val (recurse (1- val)))` requires accumulation and can't be tco'd, while `(if (<= val 0) accum (recurce (1- val) (* val accum)))` can be optimized; but without semantic analysis they both have the structure `(SOMETHING SOMETHING SOMETHING (recurse ARGS))`
<beach> Why do you need named LET? Common Lisp has good iteration constructs.
<nytpu> just as a mental exercise
<beach> OK, I see.
<nytpu> but it seems to be surprisinglyg nontrivial, to the point i don't wanna try actually implementing it
<beach> I am not surprised that it is hard. I don't see how to do it, other than turning the entire code into a TAGBODY.
<Bike> i would think that you'd use labels and let the implementation take care of it, rather than manual TCO
prokhor__ has joined #commonlisp
<Bike> a syntactic analysis would get you most of the way there, i think. still nontrivial.
prokhor has quit [Remote host closed the connection]
vxe420 has quit [Ping timeout: 283 seconds]
IUSR has quit [Ping timeout: 283 seconds]
Colleen has quit [Write error: Broken pipe]
IUSR has joined #commonlisp
Colleen has joined #commonlisp
<Bike> the labels version would just be (let NAME ((VAR VALUE)...) ...) => (labels ((NAME (VAR...) ...)) (NAME VALUE...)). racket docs give almost exactly that, even.
<beach> Oh, I thought the idea was to allow optimized tail calls on implementations that don't.
<nytpu> Bike: but afaik if the implementation doesn't do TCO, the naive implementation just using LABELS wouldn't be optimized either (iirc even one of the implementations that does do TCO normally doesn't do it for functions defined with LABELS)
vxe420 has joined #commonlisp
<Bike> if your implementation doesn't do TCO you're probably gonna have a bad time writing schemey code regardless
jeosol has joined #commonlisp
<nytpu> someone elsewhere mentioned you could do trampolining, which gives you space guarantees but no speed guarantees
harps has joined #commonlisp
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
robin has quit [Read error: Connection reset by peer]
harps has quit [Remote host closed the connection]
harps has joined #commonlisp
<paulapatience> Serapeum has nlet, which is similar: https://github.com/ruricolist/serapeum/blob/master/iter.lisp#L22
<ixelp> serapeum/iter.lisp at master · ruricolist/serapeum · GitHub
<paulapatience> It uses tagbodies
robin has joined #commonlisp
GreaseMonkey has quit [Remote host closed the connection]
Nilby has quit [Ping timeout: 248 seconds]
Nilby has joined #commonlisp
ttree has quit [Ping timeout: 265 seconds]
Oladon has quit [Quit: Leaving.]
X-Scale has joined #commonlisp
rgherdt has joined #commonlisp
karlosz has joined #commonlisp
Posterdati has quit [Ping timeout: 246 seconds]
frgo has quit [Ping timeout: 252 seconds]
harps has quit [Ping timeout: 252 seconds]
Posterdati has joined #commonlisp
psvensson has joined #commonlisp
psvensson is now known as repeter
igemnace has quit [Ping timeout: 252 seconds]
_cymew_ has joined #commonlisp
shka has joined #commonlisp
aartaka has joined #commonlisp
harps has joined #commonlisp
Inline has joined #commonlisp
pve has joined #commonlisp
<elderK> beach: I find named-let a little nicer to read. It maybe depends on the problem at hand.
<elderK> I'm finding that loop is great for simple stuff but for some things, it's kind of painful.
<beach> Nicer than iteration? Hmm.
<elderK> Then again, I'm basically back to being a newcomer. I'm sure my perspective will change as I grow experience.
<beach> Maybe so.
<elderK> I'm starting to think that if writing a single loop form is too insane looking, maybe it's best to simplify the problem and break it into multiple pieces.
<elderK> The code I'm translating from Scheme is really just expressing a nested loop but using named-let to do it.
<elderK> I'm not sure how to express that using loop in a way that looks nice.
<elderK> At least, not without nesting a loop inside of another :)
harps has quit [Ping timeout: 248 seconds]
<beach> If you are not using nested NAMED-LETs in a situation where nested LOOPs would be required, my bet is that the code is very hard to understand.
aartaka has quit [Ping timeout: 264 seconds]
<elderK> Guys, is there a paste site that's generally used to post code here?
<elderK> I've been using pastebin but it's less than ideal.
<beach> It's in the topic I think: plaster.tymoon.eu
<elderK> Thank you! irccloud is truncating the topic string :(
<beach> I would use something else then.
<beach> My bet is that irccloud doesn't have abbrevs either.
<beach> Maybe not even a spell checker?
<elderK> Aye, I should move back to using Weechat. It always did a good job :)
<beach> I am hoping that scymtym is working on something that is better than ERC. :)
<beach> ... or at least as good.
<elderK> I'm trying to understand how TinyCLOS works since I figured that'd be a good way to ease back into Scheme (and CL.) I've been trying to rewrite the TinyCLOS stuff in CL to better understand it: Being able to step through things and stuff would be great.
<elderK> This is one thing I have rewritten but what I've created seems very ugly compared.
<beach> That's not Common Lisp code.
<elderK> No, it's Scheme but I'm curious what the best way to code that in CL would be. I'm finding it hard to come up with something using Loop that looks "nice."
<elderK> I'll try again and post what I come up with for comments :)
nicm[m] has quit [Quit: You have been kicked for being idle]
_cymew_ has quit [Quit: Konversation terminated!]
_cymew_ has joined #commonlisp
<pve> elderK: I wonder if something like
<pve> (loop :for elements = [initial] :then (if [test] (cdr elements) elements) :until (null elements) ...)
<pve> could work for you?
<pve> or otherwise (loop :with elements = [initial] ..) using (pop elements) as needed.
X-Scale has quit [Ping timeout: 260 seconds]
<elderK> This is what I've come up with (but note the nested loop): https://plaster.tymoon.eu/view/3653#3653
quoosp has joined #commonlisp
_cymew_ has quit [Ping timeout: 252 seconds]
glaucon has joined #commonlisp
frgo has joined #commonlisp
Inline has quit [Ping timeout: 248 seconds]
frgo has quit [Remote host closed the connection]
<pjb> elderK: when porting code from scheme, I see no reason why not implementing scheme operators. Notably when they're used all over the place in the original code.
<elderK> By operators, do you mean constructs like named-let?
<pjb> elderK: Yes. It's way simplier to implement a named-let macro than to rewrite them into loops manually.
<elderK> Agreed but it's been a long time since I last played with either CL or Scheme in a real way. The goal isn't just to translate the code into CL but to also relearn both languages and how the stuff I'm translating works.
<pjb> In that case, ok.
<elderK> Maybe a fun challenge for next weekend to implement a named-let macro :)
karlosz has quit [Quit: karlosz]
karlosz has joined #commonlisp
les has quit [Quit: Adios]
les has joined #commonlisp
hineios has quit [Remote host closed the connection]
hineios has joined #commonlisp
hineios has quit [Quit: The Lounge - https://thelounge.chat]
random-nick has joined #commonlisp
<jcowan> nytpu: Actually most CLs do TCO even at default optimization levels: SBCL, CMUCL, Allegro, LispWorks, and CCL. In addition, ECL, CLISP, and GCL will optimize self tail calls. Only ABCL (for obvious reasons) has no tail calling at all.
<hayley> .oO( Cheney on the JVM )
<hayley> js_of_ocaml (OCaml compiled to JS) does manage to trampoline every N tail calls though.
jmdaemon has quit [Ping timeout: 255 seconds]
<jackdaniel> even for not-self tail calls ecl will put the call factually at the end, so if the underlying C compiler feels like it then the tail call optimization will happen
karlosz has quit [Quit: karlosz]
karlosz has joined #commonlisp
<repeter> Maybe this has been asked a lot of itmes, but why does it take so long for a package to become available to load from quicklisp?
<repeter> The author of a package I'd like to use have regsitered an issue with the ql repo on Jan 5 and I'm still waiting for it to become available. Has something happened to the maintainer maybe?
<pjb> repeter: you could has him. But indeed, there's a single person doing it. There are alternative distribution (eg. https://ultralisp.org )
<ixelp> Ultralisp - Fast Common Lisp Repository
<pjb> repeter: you can always download the system yourself in ~/quicklisp/local-projects/ or some other place that you'd list in ql:*local-project-directories*
semarie has quit [Quit: WeeChat 3.8]
semarie has joined #commonlisp
hineios has joined #commonlisp
semarie has quit [Ping timeout: 264 seconds]
semarie has joined #commonlisp
occ has quit [Ping timeout: 248 seconds]
occ has joined #commonlisp
<repeter> pjb: Yes, of course. I was just rtying to make sure that the project which I'm working on would be easy to set up, with dependencies and everything
<repeter> I will ask, thanks
quoosp has quit [Ping timeout: 264 seconds]
morganw has joined #commonlisp
aartaka has joined #commonlisp
markb1 has quit [Quit: Leaving]
<_death> Shinmera: cool.. think you have a typo spelling scymtym's name in section 5
<mariari> I should try out Alloy some time to do some basic graphics modeling, I'd be curious if its' easier to use than MCCLIM is
pmwals09 has joined #commonlisp
elderK has quit [Quit: Connection closed for inactivity]
aartaka has quit [Ping timeout: 248 seconds]
holycow has joined #commonlisp
<holycow> #clschool
aartaka has joined #commonlisp
pmwals09 has quit [Remote host closed the connection]
attila_lendvai has joined #commonlisp
<Shinmera> _death: so I do, thanks
<Shinmera> mariari: probably not!
_cymew_ has joined #commonlisp
amoroso has joined #commonlisp
<pve> I'm considering trying a mixin-based approach to what I'm doing currently. Are there any pitfalls one should be aware of? By "mixin-based", I mean defining several classes where each class represents certain aspects/behaviour and then combine the classes to get a "complete" class. Not sure if "mixin" is the correct term here, never tried this before seriously.
amoroso has quit [Changing host]
amoroso has joined #commonlisp
<pve> It seems pretty flexible, but also a bit complicated.
amoroso has quit [Client Quit]
<pjb> pve: you can use the term mixin. Note that CLOS itself just has classes and multiple-inheritance doesn't really make a difference between the classes (only their order, to compute the applicable method list.
amoroso has joined #commonlisp
<Shinmera> as usual you can lose sight of how the behaviours combine
<pjb> pve: a mixin would be a simple class that provides a simple additionnal behavior.
<Shinmera> and if you're not careful in your design they could combine in unexpected ways.
<pjb> the key is in the methods for the various classes and subclasses.
<pjb> You may have to define an API of the "main class" for a mixin (a set of defgeneric).
<_death> a good rule of thumb is to always place the mixins first in the superclass list
<pve> Shinmera: ok, I was afraid that might happen
<pve> pjb: ok, that was pretty much what I was thinking of
pfd has joined #commonlisp
<_death> I remember the Flavors paper by Cannon was useful to understanding mixins
<pve> _death: so the mixin behaviour gets precedence?
<_death> pve: it also prevents conflicts when the inheritance structure becomes more messy.. note that there's also meaning to the order of mixins themselves
<_death> I think the paper I mentioned discusses it
<pve> ok, thanks
X-Scale has joined #commonlisp
morganw has quit [Read error: Connection reset by peer]
epony has quit [Quit: QUIT]
<jeosol> good morning all!
<beach> Hello jeosol.
<jeosol> hi beach, how are you doing?
<beach> jeosol: Quite well thank you. Great progress on indentation in Second Climacs.
<beach> jeosol: How about you?
<jeosol> beach: oh nice. That's good to know. Haven't been here much, pulled away by some other activities.
<beach> I see.
Inline has joined #commonlisp
<jeosol> beach: I am doing well. Finally, took my project to a good place months ago. I want to try to make the els-conf this year, despite crazy schedule.
<beach> In Amsterdam, or by video?
<jeosol> beach: not sure, does any know if it's remote and live?
<beach> I think both, but I am not sure.
<jeosol> beach: that's what I wanted to ask. For now, by video if that option is available due to not likely to get time for the trip. But we'll see.
<jeosol> beach:  I will look into it, and see if the video option is available.
<beach> I think the important part of a conference is to meet and talk to the participants, often over meals or coffee. The talks are interesting too, of course, but one can always read the papers.
<jeosol> beach: I will hope to meet the guys in person. Meet and discussion is good, can discuss issues, explore projects, etc.
<beach> Exactly!
igemnace has joined #commonlisp
<mariari> is there a way to run code on object deallocation, we can launch custom code on CLOS allocation (make-instance :after ...), I'd ideally like something similar for when GC runs and the object gets removed from access, sort of a GC on the class allocated hashtable
aartaka has quit [Ping timeout: 248 seconds]
<nytpu> mariari: the trivial-garbage library has finalizers: https://trivial-garbage.common-lisp.dev/#d0d0e0e0e0e2
<ixelp> Trivial Garbage
aartaka has joined #commonlisp
<mariari> thanks nytpu
amoroso has quit [Quit: Client closed]
karlosz has quit [Quit: karlosz]
amoroso has joined #commonlisp
frgo has joined #commonlisp
karlosz has joined #commonlisp
karlosz has quit [Ping timeout: 265 seconds]
karlosz has joined #commonlisp
eddof13 has joined #commonlisp
tyson2 has joined #commonlisp
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
eddof13 has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
eddof13 has joined #commonlisp
<Bike> mariari: if you're storing instances in the hash table, you might want a weak hash (also in trivial-garbage) table rather than finalizers
foxfromabyss has joined #commonlisp
foxfromabyss has quit [Client Quit]
<mariari> Bike: I could, I probably should have considered that a bit more. eq on objects basically just goes down to sxhash anyways, so it should be the same
igemnace has quit [Remote host closed the connection]
igemnace has joined #commonlisp
X-Scale has quit [Quit: Client closed]
<nytpu> mariari: yeah, i was going to say that i'd question the design if you need finalizers in pure CL code, they're mostly intended for CFFI and such where you need to free external resources
waleee has joined #commonlisp
attila_lendvai has quit [Read error: Connection reset by peer]
<mariari> well it's more just meta information. I allocate it once per class. I'll probably make use of weak hashtables even inside where each value is a hashtable with stable and volatile storage so there can be long term associated data and short term
attila_lendvai has joined #commonlisp
<mariari> I just never saw the weakness key used for hashtables before
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
amoroso has quit [Quit: Client closed]
amoroso has joined #commonlisp
eddof13 has joined #commonlisp
<mariari> hmm, even after calling (tg:gc :full t) when the objects are not reachable, it seems to not have depopulated the hashtable.
amoroso has quit [Quit: Client closed]
<mariari> nevermind the sly inspector kept them alive without me realizing
<mariari> thank you Bike and nytpu
aartaka has quit [Ping timeout: 268 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tyson2 has quit [Remote host closed the connection]
<Bike> no problemo
eddof13 has joined #commonlisp
Oladon has joined #commonlisp
amoroso has joined #commonlisp
pfd has quit [Ping timeout: 260 seconds]
amoroso has quit [Quit: Client closed]
emanuele6 has quit [Ping timeout: 248 seconds]
emanuele6 has joined #commonlisp
jeosol has quit [Quit: Client closed]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jeosol has joined #commonlisp
ttree has joined #commonlisp
ym has joined #commonlisp
amoroso has joined #commonlisp
amoroso has quit [Client Quit]
attila_lendvai_ has joined #commonlisp
amoroso has joined #commonlisp
attila_lendvai has quit [Ping timeout: 246 seconds]
sedzcat has joined #commonlisp
eddof13 has joined #commonlisp
xaltsc has joined #commonlisp
pve has quit [Ping timeout: 248 seconds]
marsia has quit [Ping timeout: 260 seconds]
akoana has joined #commonlisp
karlosz has quit [Quit: karlosz]
karlosz has joined #commonlisp
cage has joined #commonlisp
aartaka has joined #commonlisp
glaucon has quit [Quit: Leaving.]
morganw has joined #commonlisp
pve has joined #commonlisp
varjag has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
haoms has joined #commonlisp
marsia has joined #commonlisp
epony has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 28.2]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #commonlisp
jmdaemon has joined #commonlisp
sedzcat has quit [Quit: sedzcat]
varjag has quit [Ping timeout: 268 seconds]
varjag has joined #commonlisp
aartaka has quit [Ping timeout: 268 seconds]
aartaka has joined #commonlisp
haoms has left #commonlisp [#commonlisp]
aartaka has quit [Ping timeout: 252 seconds]
Oladon has quit [Quit: Leaving.]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tyson2 has joined #commonlisp
ym has quit [Remote host closed the connection]
greaser|q has joined #commonlisp
ym has joined #commonlisp
greaser|q has joined #commonlisp
greaser|q has quit [Changing host]
greaser|q is now known as GreaseMonkey
ym has quit [Remote host closed the connection]
ym has joined #commonlisp
ym has quit [Remote host closed the connection]
pve has quit [Quit: leaving]
igemnace has quit [Remote host closed the connection]
karlosz has quit [Remote host closed the connection]
attila_lendvai_ has quit [Read error: Connection reset by peer]
ym has joined #commonlisp
_cymew_ has quit [Ping timeout: 268 seconds]
amoroso has quit [Quit: Client closed]
rgherdt has quit [Remote host closed the connection]
robin has quit [Ping timeout: 248 seconds]
hineios has quit [Quit: The Lounge - https://thelounge.chat]
hineios has joined #commonlisp
Oladon has joined #commonlisp
karlosz has joined #commonlisp
varjag has quit [Quit: ERC 5.4.1 (IRC client for GNU Emacs 29.0.50)]
X-Scale has joined #commonlisp
karlosz_ has joined #commonlisp
karlosz has quit [Ping timeout: 255 seconds]
karlosz_ is now known as karlosz
karlosz_ has joined #commonlisp
karlosz has quit [Ping timeout: 252 seconds]
karlosz_ is now known as karlosz
morganw has quit [Remote host closed the connection]
ym has quit [Ping timeout: 248 seconds]