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 quit [Client Quit]
random-nick has quit [Ping timeout: 252 seconds]
s-liao has joined #commonlisp
igemnace has quit [Ping timeout: 256 seconds]
taiju has quit [Ping timeout: 252 seconds]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Read error: Connection reset by peer]
taiju has joined #commonlisp
Inline has quit [Ping timeout: 256 seconds]
Inline has joined #commonlisp
luna-is-here has quit [Ping timeout: 268 seconds]
luna-is-here has joined #commonlisp
varjag has joined #commonlisp
luna-is-here has quit [Read error: Connection reset by peer]
luna-is-here has joined #commonlisp
Spawns is now known as Spawns_Carpeting
notzmv has quit [Read error: Connection reset by peer]
Fare has joined #commonlisp
notzmv has joined #commonlisp
poselyqualityles has joined #commonlisp
akoana has joined #commonlisp
Catie has quit [Quit: heading home]
<Xach> 
amb007 has quit [Remote host closed the connection]
taiju has quit [Remote host closed the connection]
<Xach> (oops)
amb007 has joined #commonlisp
taiju has joined #commonlisp
epolanski has quit [Quit: Connection closed for inactivity]
Oladon has quit [Quit: Leaving.]
abrantesasf has quit [Remote host closed the connection]
ec_ has quit [Ping timeout: 276 seconds]
<hayley> The function COMMON-LISP-USER::OOPS is undefined.
<dre> lel
unyu has quit [Quit: WeeChat 3.3]
Guest74 has joined #commonlisp
varjag has quit [Ping timeout: 256 seconds]
<semz_> I'm not happy to ask this, but does there exist a CL implementation that compiles to Javascript?
semz_ is now known as semz
<Guest74> _death: while interesting it wouldn't work. This would be for reading/writing to dumb buffers gotten from drm.
unyu has joined #commonlisp
<Guest74> bike: shouldn't it be possible to have the header in lisp and simply have the pointer to the data point to foreign memory? Or header and data are contiguous?
Fare has quit [Ping timeout: 252 seconds]
<Bike> usually they're contiguous
<Bike> i mean, why wouldn't they be, right?
<Bike> it would just b e adding an indirextion for no reason
<Guest74> well, normally. Except for this reason.
NotThatRPG has joined #commonlisp
Inline has quit [Ping timeout: 256 seconds]
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Oladon has joined #commonlisp
sander has quit [Quit: So long! :)]
sander has joined #commonlisp
taiju has quit [Ping timeout: 252 seconds]
<semz> hayley: thanks
varjag has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
taiju has joined #commonlisp
waleee has quit [Quit: WeeChat 3.3]
poselyqualityles has quit [Ping timeout: 256 seconds]
s-liao has joined #commonlisp
s-liao has quit [Quit: Ping timeout (120 seconds)]
s-liao has joined #commonlisp
<dbotton> Wanted to share very early work on CLOGs GUI/Web Builder https://usercontent.irccloud-cdn.com/file/yq1ZLK9b/Screenshot%20(2).png
pdietz has quit [Quit: Client closed]
<dbotton> That is all running in a web browser, of course can run "native" by using electron / ceramic, or add the panels to any web page of any framework of any language by a simple include.
varjag has quit [Quit: ERC 5.4.1 (IRC client for GNU Emacs 29.0.50)]
Lycurgus has joined #commonlisp
<beach> Good morning everyone!
<Lycurgus> hello beach
<semz> good morning
<_death> Guest74: why wouldn't it work?
<Guest74> your readme says the mapping is read only.
<Guest74> and private. I think dumb buffers are shared.
<_death> like I said, these limitations are not inherent to the approach.. but looking at DRM dumb buffers, it indeed might not work, because you don't get to pick the buffer's offset
<_death> maybe you could create an alias mapping, not looked into it
<Guest74> ah, I just read the readme and haven't looked at the code yet. It might be useful for clx though. X allows you to provide the mmap.
Catie has joined #commonlisp
<Guest74> it's just something that would be interesting for the future. copying the array to foreign is sort of a poor mans double buffering.
<_death> the way it works is to have a page before the pages of interest where the last bytes are the array's header
<Guest74> that makes sense
<Guest74> that will probably work really nice for x if there's no problem pinning it.
<Guest74> I was just thinking of the shared memory extension, but sounds like it'd possibly work for the buffer as well.
<_death> it's foreign memory, so no need for pinning
NotThatRPG has joined #commonlisp
<_death> but this header creation etc. really belongs to the implementation.. so it should probably be a contrib or something
s-liao has quit [Quit: Client closed]
<Guest74> I think I eventually need to run on something besides sbcl. Maybe once everything is working smoothly.
Bike has quit [Quit: Lost terminal]
semz has quit [Ping timeout: 268 seconds]
Lycurgus has quit [Quit: Exeunt]
akoana has quit [Quit: leaving]
semz has joined #commonlisp
aartaka has joined #commonlisp
abrahms` has joined #commonlisp
<abrahms`> Hi all. I'm trying to figure out how to iterate across the Nth item of a bunch of lists. I have a list of lists. I want to process the first element of each list, then the second item of each list. I feel like there should be a way to do this without setting a variable and looping index by index.
lisp123 has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
Inline has joined #commonlisp
pranavats has left #commonlisp [Disconnected: Replaced by new connection]
lisp123 has quit [Ping timeout: 252 seconds]
Inline has quit [Remote host closed the connection]
pranavats has joined #commonlisp
notzmv has quit [Ping timeout: 252 seconds]
<akater[m]> abrahms`: apply mapcar or apply mapc, or it's unclear what you want, show a form&result snippet.
taiju has quit [Ping timeout: 252 seconds]
<abrahms`> (group-by-column '((1 2 3 4) (5 6 7 8)))
<abrahms`> => '((1 5) (2 6) (3 7) (4 8))
<abrahms`>
<abrahms`> Then I would want to map over the result, so if it's combined with map, that's great.
<dre> I am smashing out this aoc :D
<dre> I mean it's not going to be neat but I'm getting better.
<abrahms`> T_T I'm terrible at this right now. Spent 2.5hrs on it yesterday in what would have taken me ~20m in python.
<abrahms`> I conceptually know what I want to have happen, and I'm fairly certain it's doable (and maybe even a good idea?) in lisp.. I just don't know the incantation for it.
<Guest74> like akater said, apply mapcar #'list if you want a list. Is this for AoC?
<abrahms`> Guest74: Yes. Didn't occur to me that it may spoil things for others until you just asked. :-/
<Guest74> The test examples help to find stupid errors. I keep forgetting that and wasting time, finally got it after using the test data.
<abrahms`> Is there a repl command for "give me the docs on this thing"?
<Guest74> describe or documentation
<Catie> Documentation is gonna work across more implementations, but it's more unweildy
<Guest74> and of course if you're on emacs and it's setup C-c C-d h will take you to clhs.
<abrahms`> I was hoping the docs were more clear than clhs :-/
<akater[m]> abrahms`: btw If you have only two list elements, maybe just write a loop with 2 for clauses.
<abrahms`> akater[m]: thx. I have many, but just trying to keep the example small.
aeth has quit [Ping timeout: 256 seconds]
<Guest74> is there an easy way to turn a bit array into an integer? I have a horrible kludge.
<Catie> Guest74: My understanding is that you just have to iterate over the whole bit vector
aeth has joined #commonlisp
<Guest74> that's what I'm doing and it looks horrible. even moreso with lsb
<dre> abrahms`, day one totally screweed me over
<dre> I'm also more of a python developer
<beach> Catie: What made you think that generic functions were not used much?
<mfiano> beach: She was talking about their naming in class accessors if you read more.
<beach> Oh! Misunderstood! Thanks.
<Catie> No worries! It definitely reads that way in context
<abrahms`> Day one was mostly fine. I was struggling to figure out how to load in a test runner. Day two was spent figuring out how to correctly convert a string into a callable symbol. I had forgotten about funcall. :-/
<Guest74> radix 2, hm, I probably could have used that and just ldb.
<dre> oh shit
<dre> the test input is 5 binary digits, but the real input is like 10
<dre> 12
<Catie> Guest74: This is what I came up with, I don't think it looks that bad: http://ix.io/3GQq
<Catie> I wouldn't necessarily call it efficient though
<dre> how do i convert my count-ones-per-position into a more generic function?
<Guest74> catie: reverse! why didn't i think of that. Summing also looks nicer, I was dpb'ing bits.
<dre> oh damn this really has me a bit stumped.
<dre> how did others do the "count for each position" ?
<Catie> dre: maybe this? http://ix.io/3GQr
<dre> originally I just hard-coded first second third .. etc.
<dre> Catie, ??? that's count in that row, but I want to count in the column.
<dre> transpose? is that possible? no idea
<mfiano> Here's an idea. Store an array of integers if you actually need an integer
<mfiano> bit vectors don't really buy you anything over a fixnum, except more bits, and lots of consing using the result of a bignum
<dre> is that to me?
<dre> I've got the test solution worked out, https://gist.github.com/Dotrar/dcd4bf24dc4dcec0f11eeb1cfaea2583
<dre> I just need to re-do that top count-ones-per-position function
<dre> something like nthcar for each index of the first element?
<Catie> mapcar'ing over many lists in parallel processes their elements in order, similar to how you hard-coded first, second, etc
<dre> and just store the int/counts?
<beach> dre: You need to start paying more attention to your code layout. Sometimes LET is followed by 1 space, sometimes by 2, sometimes by 0. Sometimes COERCE is followed by a newline, sometimes not.
<dre> wait no, we could just mapcar, then sum
<beach> dre: You want to avoid distracting the person reading your code with small stuff like that.
<dre> yeah sorry about that, still battling edit
<dre> editor *
<dre> will improve. getting somewhere
igemnace has joined #commonlisp
<dre> ok, so I can get to a '((0 1 0) (1 1 1) (0 0 1)) list, but how can I sum that into => (1 2 2) ?
<dre> (apply '+ list) doesn't work
abrahms` has quit [Remote host closed the connection]
abrahms` has joined #commonlisp
<Catie> (apply #'mapcar #'+ list)
* dre 's mind blows *
<dre> Catie, thanks :)
<Catie> Any time!
lisp123 has joined #commonlisp
s-liao has joined #commonlisp
gaqwas has joined #commonlisp
<susam> Good morning, #commonlisp! Hope you all are having a great Friday! :)
lisp123 has quit [Quit: Leaving...]
s-liao has quit [Quit: Client closed]
Cymew has joined #commonlisp
nature has joined #commonlisp
taiju has joined #commonlisp
<dre> ;;;_;;; I've had two beers and now I'm lost
Catie has quit [Quit: sleepy]
attila_lendvai has joined #commonlisp
makomo has quit [Ping timeout: 252 seconds]
Algernon69 has joined #commonlisp
lisp123 has joined #commonlisp
pve has joined #commonlisp
<flip214> I guess that (mapcar (alexandria:curry #'reduce #'+) '((0 1 0) ...)) would scale better than an apply
<pjb> Indeed.
Algernon91 has joined #commonlisp
notzmv has joined #commonlisp
Algernon69 has quit [Ping timeout: 252 seconds]
<dre> how can I use the debugger effectively? trying to run my code, I come up to an error but if i use BACKTRACE -- I don't know how to parse the output
<dre> 13: ((FLET "WITHOUT-INTERRUPTS-BODY-14" :IN SAVE-LISP-AND-DIE))
amb007 has quit [Ping timeout: 252 seconds]
amb007 has joined #commonlisp
<pjb> dre: assumedly, in the function save-lisp-and-die, there's a function defined with flet, perhaps WITHOUT-INTERRUPTS-BODY-14, and that frame corresponds to the activation of that local function.
<dre> I get that
<dre> the answer really is use slime innit
<dre> ah geez
gaqwas has quit [Ping timeout: 256 seconds]
<dre> OK cool, slime doesn't make things much easier :P
<abrahms`> s/may/my/
MichaelRaskin has quit [Read error: Connection reset by peer]
<dre> that looks nice actually, blows my mind more than mine. I'm trying to not use packages ( by ignorance, not by intention :P) https://gist.github.com/Dotrar/dcd4bf24dc4dcec0f11eeb1cfaea2583
<dre> I'm working on part 2 right now
<dre> but I'm fighting the debugger.
<dre> I still get "unknown location" on an error and I have no idea where it is.
<abrahms`> the packages are literally for writing small tests & logging (b/c I didn't know there was a print function)
<dre> oh right XD
<abrahms`> I'm trying to do this without just writing a for loop. Think I might be in over my head for #2.
Oladon has quit [Quit: Leaving.]
<dre> I've sorta got it. part 2 is interesting when you get through the cruft of it
<dre> when you get the gamma binary value, you use that as a filter on the list, down to single values. so if the gamma is 10101, filter all the items that start with '1', have you got 1 left? no? then filter down all the items that have '0' in the second spot, have you got 1 left? no? then ....
<dre> this is what I've got so far for number 2: ( just updated gist, refresh) https://gist.github.com/Dotrar/dcd4bf24dc4dcec0f11eeb1cfaea2583
<abrahms`> going to not click it yet. Haven't given up hope, but the clock is against me b/c I'm tired.
<dre> Yeah same, I'm turning off.
<dre> good luck abrahms` ~~ fresh mind tomorrow.
amb007 has quit [Ping timeout: 256 seconds]
<abrahms`> I'm hoping to get this mostly done tonight so I don't just think about this all day at work tomorrow.
amb007 has joined #commonlisp
<dre> does anyone know where my error might be? so when I run the "aoc-process-part-2" - I get past the "princ binary-commons" bit, but somewhere in the filter-down-to-one I get an error.
<dre> abrahms`, tbh I was sad that I couldn't chew on yesterday's problem. I solved day-2 too fast.
<dre> and this one just seems to be fighting some compilation error :(
<abrahms`> day 2 took me like 2.5 hours b/c I couldn't figure out how to turn a string into a callable symbol.
* dre still doesn't know how to do that
<dre> coerce-function or something? xD
<dre> actually I think that's in one of my books. I think land of lisp does it
s-liao has joined #commonlisp
<abrahms`> https://gist.github.com/justinabrahms/30eb516358bc72a7e16b802136b8b025 - Learned about destructuring-bind when I showed it to someone.
<abrahms`> funcall + find-symbol
frgo has quit [Ping timeout: 252 seconds]
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
<lisp123> suprised how many people are doing advent of code -- didn't know it was such a huge thing
taiju has quit [Ping timeout: 252 seconds]
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
<flip214> I've got a DEFPACKAGE that does (:IMPORT-FROM ...); during compilation of that package.lisp file I get an error that these symbols do not exist (yet), because I don't want to export them.
<flip214> Can I only import symbols that are exported within one package file?
<flip214> well, just doing (:import-from <package> <package>::symbol...) works of course, because then they're defined when DEFPACKAGE runs
<beach> abrahms`: Please try to lay out your code according to conventions. A closing parenthesis should not be preceded by whitespace.
<beach> abrahms`: And there is no reason for a blank line inside a top-level expression.
<beach> abrahms`: Nor for two consecutive blank lines.
<abrahms`> beach: is there a handy linter you recommend?
<beach> I am unaware of one.
<beach> Also, your use of (caddr acc) as a Boolean value is a violation of the rules stated on page 13 of the LUV slides by Norvig and Pitman.
<abrahms`> Ah. I tend to be a bit of a pain in that I gave up arguing about code style and now I just insist that there's either a tool or no one cares enough for it to matter to me.
<abrahms`> tbh, I'm 20% sure you're trolling me right now.
<beach> And your PROGN is unnecessary if it has a single form in its body.
<abrahms`> How do you prefer to do nil checks if not using their presence as a boolean?
<flip214> abrahms`: well, the indentation rules are built into the "important" editors emacs (and vim), so it takes work to get it wrong... therefore there's no linter
<beach> abrahms`: Not at all. When you submit code for others to read, it is important to follow conventions, or you are going to waste the time of people reading your code, simply because they are going to be distracted by all those cases where conventions are not followed.
<abrahms`> flip214: I wrote all of that code w/ emacs, so.. ?
<abrahms`> beach: the thing that threw me off was the quoting of the rules. :) Sounds very serious business.
<beach> abrahms`: If it is a true Boolean, then in an IF it is fine. But if it is NIL as a default value, then (NULL <that value>) is preferable.
<abrahms`> The code alternates between there being a function there and there being a nil. That denotes whether we're waiting on an incoming command or an incoming integer.
<beach> That doesn't alter what Norvig and Pitman describe.
<beach> abrahms`: Note that I am not talking about language semantics here. It is about the message that you send to the person reading your code.
<beach> abrahms`: And since you are submitting your code for others to read, I am giving you the feedback as one such person.
<abrahms`> beach: Cool. I appreciate the feedback. I'm not clear on how my use of if to check if something is nil or a function violates the "be as specific as your data abstractions warrant" from slide 13. http://www.norvig.com/luv-slides.pdf
<AndrewYu> p,
<AndrewYu> oops sry
<lisp123> abrahms`: You could try (defun function-exists-p (acc) (caddr acc)) or something like that. Although I would put it as a local function if its not meant to be used elsewhere
<lisp123> Just looking at the code, I would have no idea what (caddr acc) means (i'm not even sure if its function-exists-p, but I'm guess based on this chat), and in a few months you might also forget ;)
<lisp123> At least from my personal experience, I found it better to write very clear code vs. having to spend hours later trying to figure out WTF i did
<abrahms`> It's a good callout. I haven't gone back and edited it, but after showing this to someone, they told me about destructuring bind which simplifies some of the shenanigans in there.
shka has joined #commonlisp
<lisp123> Yeah, destructuring-bind is useful for these situations
hhdave has joined #commonlisp
<lisp123> Although I personally have been avoiding its use to some degree, I think it might cause interface & implementation to overlap
<lisp123> Since you are assuming a list structure. If later you wanted to use a structure or class to represent the data object, then you will have to go back and rewrite all parts of your code that rely on it being alist
<beach> abrahms`: What lisp123 says. If your value can be a function or NIL, then you can use FUNCTIONP or NULL to test one way or the other. If it is a Boolean, i.e., it is either true or false, using it directly in the TEST of an IF is fine.
<abrahms`> I haven't played much w/ the non-list data types in a long while. I did PCL ~5+ years ago and I don't use common lisp regularly. Just picked it up for advent of code.
<beach> And, yes, CADDR is not a great abstraction.
<lisp123> abrahms`: Hopefully you are enjoying it and will use it much more :)
<abrahms`> lisp123: It's mind-bending and difficult currently. I'm dramatically faster in my primary languages.. with time & effort I'm sure it'll improve.
s-liao has quit [Ping timeout: 256 seconds]
<lisp123> abrahms`: Yeah, I think we have all felt that to a degree. For me certainly, but I've learnt a lot and glad I stumbled upon it. And even if you don't program in lisp too much in the future, you can re-use some of its concepts in other languages
asen has joined #commonlisp
<lisp123> Recursion, higher-order functions and the CLOS approach to OO programming were the main things I picked up
s-liao has joined #commonlisp
igemnace has quit [Quit: WeeChat 3.3]
elderK has joined #commonlisp
<abrahms`> Totally. I've got a solid grasp on recursion & higher order functions.. I haven't played with CLOS at all though. Anyhow.. I'm off to bed. g'night.
abrahms` has quit [Quit: ERC (IRC client for Emacs 27.2)]
taiju has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
<beach> I keep being puzzled by this phenomenon. Even some professional programmers seem to be unaware of the existence of coding conventions. Is it that the existence of such conventions is not taught? Or is it that these professional programmers have not had any training? I am not talking specific coding conventions for specific languages, but even the very existence of conventions seems to be questioned here from time to time.
<susam> If you observe this phenomenon in younger programmers, it totally makes sense. I don't say this with the intention of being disrespectful. It's just the reality today. A lot of people who get into programming these days, get into it with motives different than what we had when we were younger. For example, for many programming might just be a way to earn money and they do not care about it beyond their
<susam> job.
cranium has joined #commonlisp
lisp123 has joined #commonlisp
<hayley> Can't reproduce that here, sorry.
<beach> That, I understand. What I don't understand is how these people managed to get hired to become professional programmers.
<hayley> For some people, perhaps, but they're older than me (but then, say 25 is "older" for me, and not for you two).
<susam> Because hiring at many company these days focuses on solving leetcode type problems and some system design round. None of these really evaluates exposure to "programming culture".
<beach> Hmm.
<susam> I remember, 15 years ago, when I was conducting an interview, I used to ask the candidates if they have developed any side projects using their technology of interest. I wanted to know what kind of passion they have for programming. I considered asking such questions completely fine back then.
s-liao has quit [Quit: Client closed]
<hayley> I guess. I've thought to myself that those people would be better off growing vegetables (or literally participating in any other profession), since otherwise they seem to think very negatively of programming.
<hayley> *participating in literally any other profession; word scheduling is important there.
<susam> But today I think such questions may be considered controversial. In fact, I myself find it controversial. One might argue, what side projects they do is none of my business. One might argue, that I must focus on what they do on job only.
<lisp123> Eh, this all sounds elitism to be honest. There's no right way and most of these subpar programmers are producing useful code, however inefficient it may be written
<hayley> Well, short of some uninteresting very short jobs I had in high school, the résumé I wrote but never used only has side projects arguably.
<beach> I can understand why one can aspire to a profession without being passionate about it, but it is truly shocking to me that there is no filtering process.
<hayley> lisp123: It's unrelated to being a subpar programmer or not, though the people I am thinking of seem to actively encourage rubbish programming style.
<susam> lisp123: I see your point and it can indeed sound like elitism and that's why I don't share this often with others. But in my heart, I know I feel disappointed to see the craftmanship in this field gradually eroding.
<beach> lisp123: I am frequently accused of being elitist, but when I see the bugs in devices like the TV decoder or the microwave oven, I think there is a huge problem in the industry.
<susam> lisp123: By the way, are you ab....22 on HN?
<lisp123> hayley: In 'theory' there is definitely a clear divide between good code vs. bad code, good programming style vs. bad programming style. But often it might be because they were optimising for something else (less time to study / learn, spending more time on getting a proof of concept)
<hayley> My motives involve using the computer as a means of self-expression, and as a device to slack off all day. The latter part incidentally requires that I don't write bad code, else I would be stuck spending more time maintaining it.
<cranium> don't know about craftsmanship, but it's silly to expect professional programmers, i.e. people who already do this all day, to have side projects.
<Nilby> I've worked with many programmers in industry and academia, and my observation is following coding conventions is highly correlated with some ineffable personality traits, but not practical skill or education. Even when it's attempted to be enforced, it can fail.
<lisp123> (So I agree with all of your comments, but (not related at this group), often its not because said programmers or professionals were doing a 'bad' job, but they were focusing on different things)
Lord_of_Life has quit [Ping timeout: 252 seconds]
Lord_of_Life_ has joined #commonlisp
<lisp123> beach: But your code quality is very high, can't expect that from everyone IMO.
<susam> Nilby: I have enforced coding conventions in my teams and it has worked. At least 3 of those engineers have told me after a year that while they hated it initially, they love it now and they see the benefits of following coding conventions.
<hayley> lisp123: I think those targets for optimisation are subjective too. With regards on getting a proof of concept: I have heard some people to write buggy code to illustrate a point. Some other people, like Leslie Lamport, argue that having a mathematical model suffices as a proof of concept, and if such a model can be checked, it is probably not buggy too.
<beach> lisp123: You misunderstood my opinion. I expect no such thing. I merely expect people to recognize that there is such a thing as coding conventions, separate from the concept of semantics.
* rotateq experienced some filtering: "Oh, you can't do Java or some of our other mainstream web/app technologies and just understand things well we don't know? Then we cannot use you."
<pve> It may be that if someone is trying to learn a new language by themselves, they do not prioritize learning conventions early on, even if they know such a thing exists. It only becomes a problem when they go on irc and try to show their code.
<cranium> what kind of code conventions? Formatting stuff, review process, design things...?
hhdave has quit [Ping timeout: 256 seconds]
<hayley> What are we talking about again?
<beach> pve: But the phenomenon I describe is that people don't even recognize that there is such a thing, or at least not the importance of conventions.
s-liao has joined #commonlisp
<cranium> Things like the former two should be done/enforced by tools. Configure your code formatter, add it to vcs and forget about the topic.
Lord_of_Life_ is now known as Lord_of_Life
<beach> cranium: Code layout is the most basic stuff. But then there is naming conventions, organizing the code into modules, simplifying maintenance by making the code easier to read, etc.
<beach> cranium: The "Boolean vs. default value" issue can hardly be automated.
<hayley> Once I went and looked at some automated code "quality" tool (which did not support Common Lisp, of course), and looked at the warnings it produced. The warnings consisted of stuff like "There is a line with nothing but spaces on it." Who actually cares about that?
<rotateq> So things like those Norvig covers in his style guide.
<lisp123> susam: No idea on that
<pve> beach: I understand. Though, I could see someone considering Lisp so alien in the beginning, that the notion of "conventions" flies out the window.
<susam> lisp123: No idea about? Sorry, I couldn't figure which message you are replying to.
<beach> Hmm.
<lisp123> hayley: Sure, I think the argument goes both ways. "My code was bad because I was focusing on "business"", when it was just bad
<hayley> lisp123: Your business is damned if you do nitpick your code, and damned if you don't.
<mzan> The best solution is like "go fmt". You code is formatted automatically by a tool.
<susam> Haha! That's quite true, hayley! I love it and I am going to steal your line and use it in future.
<lisp123> beach: Sorry, I was probably slightly confused. I think that following good coding conventions is positively correlated to good code quality, so one should expect poor adherence to coding conventions in the same way one should expect poor code quality (because it does and will keep happening)
<mzan> Hi, I'm stuck on this https://dpaste.com/9G6666P3K The function using "series" is not compiled to an efficient loop.
<mzan> I'm using CL for AoC 2021, and I'm trying to use "series" whenever possible.
<hayley> I'm not too familiar with Series, so what does COLLECT-LAST do?
<mzan> The code is working, but I'm not happy knowing that if the input file is too big, it will crash, because it should be compiled to an efficient loop working on streams.
<mzan> hayley: collect-last take the last element of a series
<mzan> So it should be a loop on all elements of the series (i.e. random numbers), discard them, and then return the last element.
<hayley> Why even produce N random integers then?
<mzan> Because I tried to isolate the problem.
<mzan> I have the same problem on real code, but with a lot more complex series.
<mzan> I like series because I used Haskell a lot in the past, and so they seems rather natural for me. It seems also a way to create more useable code respect an explicit loop.
<mzan> s/useable/reusable (or composable)
<lisp123> beach: Thinking about it more. I think perhaps the blame should lie on all the teachers (online blogs / videos / fellow coders / (perhaps universities, but I wouldn't know since I didn't do a CS degree)) --> Had there been a stronger teaching of the importance of various concepts, some of these bad practices wouldn't propagate as much
<susam> I doubt any CS degree has ever taught what I call the "hacker culture". It is something we used to pick up by working with other developers and seeing how well established open source projects are executed. For example, when I sent my first patches to an Apache project some 15 years ago, there were multiple rounds of reviews and I learnt a lot about the culture. Other sources were just browsing online
<susam> and searching and reading about things.
<lisp123> susam: Isn't that the issue though? It should have taught these things properly vs. you finding them own as you were passionate / intelligent / hard working. Because we can't expect all to be the same
<mzan> susam: in fact some folks suggests to follow the pull-request workflow of goo OSS projects. Studying the code is useful, but reading the pull-requests can give many hints about the standards they are following.
<lisp123> I programmed as a side hobby during school and later on, but I only learnt about interface vs. implementation from #CLSCHOOL and studying lisp --> Is that a failing of myself or of the system
<susam> lisp123: I agree that there is an issue but I am not sure where the solution lies. For example, I don't have a CS degree, so even if they did teach these things as part of a degree, most people like me wouldn't learn it.
mrcom has quit [Quit: This computer has gone to sleep]
s-liao has quit [Ping timeout: 256 seconds]
<hayley> I just don't think computer science courses ever make anything seem fun. Say, one assignment might be about a made-up Mr. Robert who had an idiot intern mess up his database which seems awfully poorly constructed just so that you get to practise one particular aspect of your programming language. If it's supposed to give industrial experience, it comes off an awful like an old fable, where the entire world is constructed to teach one stupid
<hayley> lesson to the audience.
<hayley> Speaking of, the two "hackathons" I participated in were devoid of any hacking, and they were solely to come up with ideas to impress someone from a big tech company, who might even hire you to let them steal your idea if you're lucky.
<susam> I just think it is a dilution and erosion of craftmanship which is natural when a field grows so much that it attracts everyone (the passionate and the dispassionate). Say, playing piano was as hot a field as computing is today. Say, anyone who can write a 30 second jingle with some basic notes gets a job and earns money. I am willing to bet that we would see the same erosion of craftmanship in that
<susam> field too.
<lisp123> hayley: I dropped out of my IT degree aeons ago because it was so removed from actual programming :( I blame myself but I know what you mean
<hayley> A month ago or so I watched some videos of the late Seymour Papert teaching programming. His audience was much younger children, but I still felt robbed of any actually engaging materials.
<pjb> lisp123: try https://42.fr/en/homepage/
<lisp123> pjb: Thanks for the link, it looks very cool
<susam> hayley: Was he teaching Logo?
<hayley> I got the same feeling from reports on early use of Smalltalk, which Adele Goldberg and Alan Kay taught to children. In "Personal dynamic media" <http://www.newmediareader.com/book_samples/nmr-26-kay.pdf> there are quite a few brilliant programs...written by children. It's really insulting when I was 18 upon entering university, and spent a whole semester writing programs which would read and write crap into a hash table, more or less.
<hayley> semz: Right, yes.
<hayley> I believe someone wrote something similar about teaching mathematics...
<hayley> The first page is quite ironic for me, because I dropped out of music classes at high school because I was terrible with music theory.
igemnace has joined #commonlisp
<susam> Logo has had a big impact on my life. I have written a small post about it here: https://susam.in/blog/fd-100.html
<hayley> Here is one such video: <https://www.youtube.com/watch?v=ZG9cYhekB8A>
<lisp123> susam: very cool diagrams for 1990s
<susam> lisp123: Yes, indeed. Imagine the joy of a childhood kid getting excited drawing those stuff on an otherwise boring monochrome CRT display. The video link shared by Hayley is pretty cool too. I indeed used to spend a lot of time drawing those random raft patterns showed at 10:40 of the video.
kevingal has joined #commonlisp
<beach> lisp123: Sure, but you can't be an expert from day 1, so it takes time to learn about the conventions. But you can't learn if you don't even acknowledge the existence of such conventions.
s-liao has joined #commonlisp
<lisp123> That's true
<cranium> I mean it's impossible to not acknowledge their existence.
<beach> cranium: As I started by saying, that is very close to the attitude that I sometimes see.
<Nilby> There's another impossible thing I've done today.
<cranium> *to not acknowledge their existence when pointed out.
<beach> You would be surprised.
<cranium> yeah I was thinking of people acting in good faith.
<beach> Oh, I think they seriously think they are right.
<susam> On the topic of conventions, I have observed for a long time that (1) hayley always enclosed the URLs with angle brackets (<>). (2) beach always uses double spaces after full stop. :)
<susam> s/enclosed/encloses/
<beach> susam: Old Emacs habit.
<hayley> Some combinations of IRC clients and/or terminals decide to include punctuation in URLs if you don't use angle brackets.
<beach> Anyway, time to go fix lunch for my (admittedly small) family and my favorite coauthor.
<cranium> bon appétit beach
<susam> hayley: Yes, I agree. I like the <> convention and I used to use it in emails for a long time.
igemnace has quit [Remote host closed the connection]
pdietz has joined #commonlisp
<hayley> Reminds me of the worst part of my CS education: the final exam required one to justify the use of Hungarian notation. I recall writing that beach wrote that it was mean to Hungarian people.
s-liao has quit [Ping timeout: 256 seconds]
<hayley> Something similar with a record-based database (cause this is the 60s and we still have tapes, and not SQL or graph databases or whatever else). They wanted the exam taker to describe why one should use binary search to find a user record by ID. I didn't, and I wrote that, if IDs were made contiguous, you could do the equivalent of id * sizeof(user_t) in C to find a user, more or less.
* hayley got a better mark on the maths test, of course.
amb007 has quit [Ping timeout: 252 seconds]
amb007 has joined #commonlisp
s-liao has joined #commonlisp
cosimone has joined #commonlisp
cage has joined #commonlisp
CrashTestDummy has quit [Quit: Leaving]
s-liao has quit [Quit: Client closed]
igemnace has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
random-nick has joined #commonlisp
pranavats has joined #commonlisp
adlai has joined #commonlisp
<semz> <susam> I just think it is a dilution and erosion of craftmanship which is natural when a field grows so much that it attracts everyone << I think this is right on the money, and exacerbated by how bad programming seems to increase demand, which lowers standards further, driving even more demand.
Algernon91 has quit [Ping timeout: 240 seconds]
<semz> how many programming jobs boil down to cleaning up after the programmer who came before?
frgo has joined #commonlisp
<jackdaniel> semz: essentially all, but 90% of cases is the case when the "new guy" underestimates the problem complexity
<jackdaniel> so often "cleaning" leads to code in even worse shape, with less features and more bugs
<pve> I admit to being the "new guy" once.
<pve> I advocated rewriting some old CL code in <superior language>.
<pve> And now look where I am :)
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<pjb> semz: when the programmer's population double every 5 years, the average experience of programmers is 5 years. That said, the rate of growth of the programmer population has reduced, we're in the top of the sigmoid, at about doubling every 40 years.
Algernon91 has joined #commonlisp
kevingal has quit [Ping timeout: 268 seconds]
hhdave has joined #commonlisp
<flip214> pjb: we're doubling every 40 years? I'm eating a lot, but not *that much*
<flip214> (No need to reply, I know what you mean)
<rotateq> pve: which "old" CL code?
asen has quit [Quit: Leaving]
axvr has joined #commonlisp
Alfr has quit [Ping timeout: 252 seconds]
etiago has quit [Quit: ZNC 1.8.2 - https://znc.in]
etiago has joined #commonlisp
lisp123 has quit [Quit: Leaving...]
edgar-rft has quit [Quit: Leaving]
dre has quit [Quit: Leaving]
tyson2 has joined #commonlisp
Bike has joined #commonlisp
hhdave has quit [Quit: hhdave]
hhdave has joined #commonlisp
hhdave has quit [Client Quit]
Lycurgus has joined #commonlisp
elderK has quit [Quit: Connection closed for inactivity]
s-liao has joined #commonlisp
<pdietz> @jackdaniel: the cleanup I like to do is supportive: is the code adequately tested?   If not, are there bugs revealed by new tests?  Too much software is still in the "good enough, ship it" state and could use firming up.
notzmv has quit [Ping timeout: 252 seconds]
<akater[m]> mzan: 1. Are you sure defun* knows anything about declare optimizable-series-function? series has its own defun to treat it. 2. sometimes series won't optimize poorly written code, by design.
<jackdaniel> pdietz: I'm not saying that all cleanups are futile, only that often people mistake necessary complexity with mess
<mzan> akater[m]: Thanks. I will check. BTW I made the first exsercise of AoC with series, the second with loop and with the third I'm using "iterate". Up to date I like very much "iterate", but probably some "series" based code is more reusable/composable.
<mzan> At the end of the AoC exsercise, I will check.
lisp123 has joined #commonlisp
<lisp123> What's the best way to generate / extract a unique id for a lisp object?
<jackdaniel> the object itself is an unique id
<lisp123> I am thinking GENSYM. But also considering whether its possible to get the number e.g. in #<TEST2 {1009F8F2F3}>
<lisp123> That's a memory address so is subject to change? Or is it relatively constant
<mfiano> That number can change at any time
<lisp123> Thought so. I guess gensym it is
<mfiano> THat isn't anymore of a unique ID than the object itself.
<lisp123> for an external process (outside of Lisp) it would be
<mfiano> Not really. There's sxhash
<lisp123> How likely are collisons?
<lisp123> Perhaps I should just send an equivalent of the form itself (e.g. specify each attribute) if that's a big issue
<mfiano> That depends on the implementation.
<mfiano> Will the external process outlive the lisp image, or is it possible that it could?
<lisp123> No they would run together
<lisp123> and end together
<mfiano> Which external process?
<_death> a simple counter will do?
<lisp123> _death: Very good idea!! Much better than gensym
<mfiano> Yes, a timestamp/serial number/simple counter is a good choice.
<random-nick> I have a related question, what is the best way to round-trip a CL object over CFFI? specifically, when a C library excepts a function pointer and a data pointer to use as a callback, how do you pass a closure over the data pointer to the CFFI callback which gets passed as the function pointer?
<lisp123> mfiano: Yes, timestamp is also very good. I think I will do that
hhdave has joined #commonlisp
<mfiano> lisp123: I didn't mean timestamp literally. That is a term given to an increasing number, also sometimes called a counter or serial number.
Lycurgus has quit [Quit: Exeunt]
<mfiano> But that will also do.
<jackdaniel> literal timestamp has a limitation that you have to wait i.e 1s to create a next one
<jackdaniel> otherwise you have duplicates
<Bike> random-nick: not my area of expertise, but could you pass #'funcall as the function pointer and the closure as the data
hhdave_ has joined #commonlisp
hhdave has quit [Ping timeout: 252 seconds]
hhdave_ is now known as hhdave
<lisp123> jackdaniel: True. The LOCAL-TIME library seems to support millisecond / microsecond, but I'm not sure how stable that is
<lisp123> Will have a think, thanks all! :)
<jackdaniel> use a counter
<jackdaniel> and all your problems are gone
<lisp123> Ok :)
<mfiano> Except perhaps the ABA problem :)
<jackdaniel> aba problem?
<mfiano> If you ever need to reclaim identifiers representing since deleted objects, you could run into a scenario where the new data looks like the old data.
s-liao has quit [Ping timeout: 256 seconds]
<pve> rotateq: I remembered wrong, it was actually a Perl script that was to be rewritten, I advocated doing it in <superior language>, while CL was kind of the default choice since a lot of other code there was written in CL.
treflip has joined #commonlisp
parjanya has joined #commonlisp
<pve> rotateq: I ended up writing it in CL on the job, and because it was a fairly small script, and I was curious, in the other language in my own time.
<pve> rotateq: I remember being blown away when the CL version (written by me, a newbie) outperformed the version written in the other language.
<random-nick> Bike: the trouble with that is that the closure might also get moved
Algernon666 has joined #commonlisp
<Bike> you'd have to pin it, i guess
<random-nick> on ECL you don't have to do anything since the GC isn't moving, on SBCL you can pin it...
<Bike> but isn't that a problem any time you pass a lisp object to C
<random-nick> but I can't find anything in CFFI which wraps that functionality
<random-nick> yes, but you usually pass C objects to C
<_death> a simple counter will do?
<etimmons> Typically i store the CL data in a hashtable with an integer id. Pass the id as the data, and then the callback knows to look up the true data in the hash table
Algernon91 has quit [Ping timeout: 245 seconds]
sirufer has joined #commonlisp
<random-nick> _death, etimmons: that's what I was thinking, and overflowing even a 32-bit pointer probably isn't going to happen much, right?
<_death> do you use a 32-bit machine?
<_death> in that case, you can't have 2^32 objects anyway ;)
<_death> well, you can over time I guess.. then you need some recycling
<random-nick> you don't need 2^32 objects alive at once
<random-nick> but yes it's still unlikely to overflow
<rotateq> pve: good to hear
hhdave has quit [Quit: hhdave]
raeda has quit [Read error: Connection reset by peer]
hhdave has joined #commonlisp
raeda has joined #commonlisp
raeda_ has joined #commonlisp
raeda has quit [Ping timeout: 252 seconds]
<jackdaniel> mfiano: thanks
Alfr has joined #commonlisp
cage has quit [Read error: Connection reset by peer]
lisp123 has quit [Quit: Leaving...]
<Guest74> beach: I think part of the problem lies in the fact that very few Lisp learning materials mention any conventions at all. I recall one talking about formatting and the gist was, use emacs. The other part of the problem seems to be in other languages you just run your code through a linter.
<rotateq> there's also a style guide by Google
<Guest74> So what's the json parser de jour? Looking for something simple to just parse responses from weather apis.
etiago has quit [Ping timeout: 256 seconds]
xsperry has quit []
pranavats has left #commonlisp [Error from remote client]
etiago has joined #commonlisp
pranavats has joined #commonlisp
makomo has joined #commonlisp
notzmv has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
<beach> Guest74: Again, I am not surprised that specific conventions for specific languages, including Common Lisp, are not known by relative newbies. And that is not a problem either, because those conventions can be learned. My surprise is that some people don't acknowledge that there is such a thing as conventions in software development, so they don't understand the importance of such conventions.
<jackdaniel> do we take convention as something that is the most commonly used or something that would be considered "more correct" under /some/ criteria?
<jackdaniel> i.e using #+nil to disable code seems to represent the former and using #+(or) the latter
<Guest74> seems to also depend which decade of code you're looking at.
<Guest74> thanks yitzi:
<Guest74> that last link doesn't look so good.
<yitzi> Oh, what do you mean?
<Guest74> lots of dark blue.
<yitzi> It only shows differences. Tests are compliant are not shown. There is like 300 tests as a I recall.
<yitzi> Or maybe 1000. It is a lot.
<yitzi> There is another library which aims for compliance in addition to the one I wrote (shasht) ... looking for the link
<mfiano> jzon
<Guest74> is that the new one? I see the tests on first link are for 2016.
<yitzi> mfiano: Thanks
<yitzi> yitzi: https://github.com/Zulu-Inuoe/jzon was written about the same time as I wrote shasht. I think we were unaware of each others efforts.
<yitzi> No idea if there have been updates to the first link
<Guest74> huh, jzon isn't on ql.
<mfiano> Zulu does not like submitting his work to Quicklisp.
<mfiano> Something about more responsibility than he has time for.
<yitzi> And blue doesn't mean bad. Yellow and orange are the really bad indicators.
<Guest74> well, I consider failed parsing bad.
<yitzi> Not all JSON is valid. Plus JSON is very ill defined.
lisp123 has joined #commonlisp
<Guest74> I just need something simple, for decoding only, that can preferably read from byte arrays. Which jzon does, but no ql is probably a problem.
<Guest74> ah, seems I can get drakma to return it as a string.
cosimone has quit [Remote host closed the connection]
cosimone has joined #commonlisp
tyson2 has joined #commonlisp
Cymew has quit [Ping timeout: 256 seconds]
yewscion has joined #commonlisp
<NotThatRPG> Krystof: Yesterday you told me that SBCL provided a way to collect the source file for an entity, but that left it as an exercise to the reader to do something with that information (store it, make it retrievable) -- do I understand you correctly?
<Krystof> That's my understanding
<lisp123> NotThatRPG: Is there something you want to do in particular?
pranavats has left #commonlisp [Disconnected: Replaced by new connection]
pranavats has joined #commonlisp
<NotThatRPG> lisp123: I have added source file recording for FiveAM tests, suites, and fixtures, which works on CCL and Allegro. I would like to make it work on SBCL, as well.
sbodin has joined #commonlisp
<NotThatRPG> I was looking into what SLY does to find source locations on SBCL to try to identify how this stuff is looked up.
gaqwas has joined #commonlisp
<lisp123> You want to find the files in which a given function or symbol is defined?
<lisp123> If so, use something like this https://pastebin.com/rB7z95Vg
<NotThatRPG> lisp123: Well sort of -- the FiveAM entities have symbols for names, and I would like to look them up akin to the way I do on Allegro (CCL is similar): (excl:source-file 'add-2 :fiveam-test)
<NotThatRPG> On Allegro and CCL there's a protocol to invoke source file recording, e.g., when doing macroexpansion of a defining form.
<lisp123> sb-introspect:find-definition-source and equivalent functions will help. Look at the sb-introspect.lisp (I think that's what its called) package to figure out which ones you need to use
<NotThatRPG> lisp123: Thanks, will do!
<lisp123> Yeah looks like that is what you are after, play around with it and then use it as you want...since a symbol can refer to variables / functions / etc., SBCL will return a list of source locations, so you need to parse that list to get what you are after
sbodin has quit [Ping timeout: 256 seconds]
<NotThatRPG> lisp123: Ugh. It's written so that the set of types it can track is not extensible (they are hard-coded into a big CASE expression)
<NotThatRPG> Would be a lot nicer if that were a generic function with EQL dispatch or something.
<lisp123> Be the change you want to see ;) Send me the generic function if you do write it, so I can use it :)
Catie has joined #commonlisp
<lisp123> If you look at the code I sent earlier (I do it for generic functions / macros / functions, but not other types of symbols), there's another function called find-definition-source that is more helpful, but expects you give it a lisp object and not a name
<lisp123> IIRC
<NotThatRPG> Looks like line 406
<NotThatRPG> (at least in my copy)
<lisp123> yes, that's the one
<NotThatRPG> Also hard-coded. This time typecase.
<NotThatRPG> Turning those into generic functions seems like a reasonable move, but potentially a total waste of time if the maintainers were not interested in seeing such a change.
<lisp123> TBH I think that function is pretty good already
<lisp123> you need to ultimately supply a lisp object right
<NotThatRPG> yes, but it has to be one of a known set of classes.
<NotThatRPG> The protocol offered by CCL and ACL seems significantly preferable
<lisp123> I think it covers nearly all cases no?
<lisp123> This is the magic line (find-definition-source (class-of object))
<lisp123> By all means, if there is a way to improve it, please do let them know as it would be very useful for a lot of us. I assumed it worked well
<NotThatRPG> lisp123: Give me a minute, and I will make a pastebin for you to see the comparison
<Krystof> I think my thought is that the consumer of the definition sources is not generic
tyson2 has quit [Remote host closed the connection]
<Krystof> so having a generic function in the middle isn't particularly helpful
<Krystof> I'd like to see the comparison with the CCL/ACL protocol but it should also cover retrieving and using the source location
<Bike> NotThatRPG: is this protocol documented somewhere?
<NotThatRPG> Krystof, lisp123, @Bike : Here's a pastebin that shows use of the protocol -- TL;DR: it works like the protocol for CL:DOCUMENTATION https://pastebin.com/NVkGiJFy
<NotThatRPG> Franz has very good docs about source file recording: https://franz.com/support/documentation/current/doc/source-file-recording.htm
<NotThatRPG> I couldn't find anything comparable for CCL (but I might easily have overlooked something). It was pretty easy to adapt the ACL method, except that it required an additional step of registering a new definition type.
<NotThatRPG> (this is shown in the paste)
<Krystof> ok, but my point stands: there's no actual advantage to a generic excl:source-file if you never call it with a variable second argument
<NotThatRPG> Krystof: You mean like (excl:source-file 'add-2 :fiveam-test) ? I'm not sure I follow the question.
<jackdaniel> it is excl:record-source-file name :type type) <--
<jackdaniel> clearly a keyword, you don't specialize on keyword parameters
<Krystof> I mean like (defun find-add-2-definitions (x) (excl:source-file 'add-2 x))
<Bike> i think what Krystof means it that if a consumer (slime, say) doesn't know :fiveam-test is valid, it will never do it, so what's the point
<Krystof> right
<jackdaniel> nvm me :)
mrcom has joined #commonlisp
tyson2 has joined #commonlisp
<Krystof> If the set of all possible types is exposed somewhere, which it might be, I can imagine a totally-generic "definition source navigator" providing an interface to that, so this is not a complete "no"
<Bike> ACL's "source-file" function has an optional type argument, like jackdaniel said, and if it's T it returns an alist of all info regardless of type
<Bike> which seems like exactly what you'd want for something like slime
<Krystof> but I bet in those circumstances you would want something to convert :fiveam-test into "FiveAM test"
<NotThatRPG> I already use this a lot for Domain Specific Languages to look up program constructs generated by various macros and parsers
<Krystof> Bike: I think it's some of what you'd want for something like slime / a clim "definition inspector", but in practice I think you'd want more
<NotThatRPG> It's simple and elegant, and ... I don't see how I would do anything like it with SB-INTROSPECT.
<lisp123> NotThatRPG: Thanks for the links, I will think about it later. It's an interesting thought for sure (and as a side, Franz has great documentation)
<NotThatRPG> Maybe it's possible, but the source isn't enough to tell me how to do it.
<Bike> yeah, you'd probably want to print it more nicely, true, but having the info at all seems likea necessary starting point
<lisp123> Although I'm still missing what SB-INTROSPECT cant' do
<lisp123> It looks up the lisp object, which should be unique
<jackdaniel> lisp123: 'foo may represent a function, a class etc
<lisp123> jackdaniel: Yeah, so one has to pass in the right object
<jackdaniel> and NotThatRPG wants it to be able to introspect also a 'foo test suite (that is not defined in cl standard)
<Krystof> (defmacro record-source-file (name type) #+sbcl (setf (getf name type) (source-location))) (flet ((source-file (obj type) (source-location-file (getf name type)))) ...)
amb007 has quit [Read error: Connection reset by peer]
<lisp123> Is that a class? If so, it should work
<NotThatRPG> lisp123: What if the lisp object is a symbol that names an object? I don't ever touch the internals of FiveAM structures.
<Krystof> sprinkle appropriate ` into the macro
amb007 has joined #commonlisp
<NotThatRPG> lisp123: One never touches the objects internal to FiveAM
<NotThatRPG> There's some complex lookup process which I don't know at all, and should not have to.
<Krystof> I don't think sb-introspect is relevant, for what it's worth
<lisp123> NotThatRPG: But that lookup process is the very essence of Lisp, a symbol can name different things
<lisp123> NotThatRPG: I will read those things, never mind me :) TBC when I do
amb007 has quit [Read error: Connection reset by peer]
<NotThatRPG> lisp123: But my not having to get anywhere near an object is the very essence of data abstraction! ;-)
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
attila_lendvai has quit [Ping timeout: 252 seconds]
amb007 has joined #commonlisp
<Krystof> put data on symbol-plists, if you have names, and/or in hash tables keyed by the object, if you have (find-thing <name>) or just the objects themselves; you don't need the internals of anything
<jackdaniel> lisp123: this is to allow questions like: tell me where I can find the source code of a test named 'clever-test (and that test is not a class)
<Krystof> (excl:source-file name type) is just a lookup of a piece of data associated with a name; store that however you like
<NotThatRPG> Krystof: Yes, I agree, the PLIST is the way to go. But then I have something that won't work with SLIME, right? Because it uses the SB-INTROSPECT API which seems (as far as I can tell) not to be extensible
<NotThatRPG> If I knew how to use function wrappers in SBCL, then I would be able to do this, I suppose.
<Krystof> possibly
<Krystof> so, yes, the support for this in slime is not generic
<Krystof> (sbcl's swank, that is; it might be elsewhere)
<NotThatRPG> Still seems like making SB-INTROSPECT hookable would be handy
<lisp123> jackdaniel: Thanks, that helped
_73 has quit [Remote host closed the connection]
<jackdaniel> great :)
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
<Krystof> with a set of standardized definition types, downstream code can make UIs to those types that are suitably adapted. Example: if for nothing else, being able to map a symbol to a user-acceptable name, but possibly other things.
edgar-rft has joined #commonlisp
<Krystof> with arbitrary user-specifiable symbol-names for types of definition, you gain a bit of genericity but lose the ability (without having additional mechanisms) to have anything else
<NotThatRPG> Krystof: If one is building something with a domain specific language, having an extensible set of definition types seems critical. I'd rather have just a symbol naming the type, instead of being shackled to a fixed set of definition types.
<Krystof> without a protocol, how can slime know how to display a heading for your fiveam definition locations (other than :fiveam-fixture)
<Bike> it doesn't seem like a loss, since without the hook you have nothing and slime knows nothing
<Bike> nowhere to go but up
<Krystof> if you're building a domain-specific language, I would venture to suggest that you don't want all the definition sources displayed, you probably want only your domain-specific definitions displayed
<NotThatRPG> Krystof: Since FiveAM fixtures, tests, and test suites can share names in a lisp-2 ish way, even just having the symbol to distinguish between different types of definition in a cross-reference list would be helpful
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
<Krystof> Yes, and you can have that. What you can't currently have, and what I'm questioning, is whether you want your user-defined definition types shown in the same place as standard definition types, with no ability to do any intercession
<Krystof> why don't you have a "show-fiveam-definitions" operation?
<NotThatRPG> Because then I couldn't use SLIME or SLY to jump to the source location (which I can with ACL or CCL), without additional programming (if I'm still following you)
waleee has joined #commonlisp
<NotThatRPG> It just seems to me that DOCUMENTATION is a good guide to what one might want to do here.
<Krystof> Well, I think that documentation is poorly-specified and painful to use in practice
<Bike> with the addition of some mechanism to get all possible metadata about an object regardless of type, the protocol seems roughly fine
<Krystof> its contents are not well-specified enough (you get a string! Woot. Good luck using it) and you specifically can't find out about all the different kinds of entities supported
<NotThatRPG> Yes, but that is because of a number of other issues (like how documentation is to be displayed), the fact that SLY and SLIME have crummy interfaces to DOCUMENTATION, etc. The lisp machines had great documentation
<Krystof> the lisp machines did not define their documentation based on the DOCUMENTATION generic function
<NotThatRPG> Right.
<Krystof> so, why are you suggesting that the DOCUMENTATION generic function is a good guide? I think it's a terrible guide
<NotThatRPG> This is something Python (at least Numpy-style) does a lot better.
clhelp has joined #commonlisp
<NotThatRPG> Krystof: I don't think the extensibility is what is bad about DOCUMENTATION
<clhelp> hey, weird question, but how do i remove dotted pair notation from the cl reader?
<Krystof> documentation can be made useful with substantial additional protocol (agreements on what should look like a hyperlink, ability to introspect, ...)
<Bike> clhelp: not possible
<Krystof> if you define a new documentation type, how can a third-party find out about it?
<clhelp> i'm writing a shell macro and it's messing with it...
<clhelp> Bike oh, that's unfortunate
<Bike> let me double check, though
<clhelp> I tried to write a reader macro to override it, but it doesn't look like it's defined via SET-MACRO-CHARACTER
<NotThatRPG> Krystof: I don't think that the terribleness of DOCUMENTATION is because it allows new types of documentation. It's because we don't have any conventions
_73 has joined #commonlisp
xaltsc has quit [Read error: Connection reset by peer]
<clhelp> (side question: what is the point of dotted pairs? that is, they don't seem more useful than a prefix representation, but i could be wrong)
<Bike> what do you mean by "a prefix representation"
<clhelp> like '(. 3 3)
<clhelp> instead of '(3 . 3)
<Bike> how would you write (4 5 . 3)?
<clhelp> oh, hm
<jackdaniel> (. 4 5 3) perhaps
<clhelp> i guess you'd have '.' make a list out of all of its arguments, yeah
<jackdaniel> and (. 4 5 3 nil) would be the same as (list 4 5 3)
<Bike> okay, yeah, i double checked, i don't think there's any way to customize the dot. that's kind of interesting
<Bike> what you could do is completely replace the ( reader macro so that it doesn't understand the consing dot
clhelp has quit [Client Quit]
<Bike> okay.
<lisp123> lol
clhelp has joined #commonlisp
<clhelp> (or a bunch of car cells, actually)
<Bike> clhelp: "okay, yeah, i double checked, i don't think there's any way to customize the dot. that's kind of itneresting. what you could do is completely replace the ( reader macro so that it doesn't understand the consing dot."
<clhelp> oh, i wasn't aware that ( was a reader macro! yeah, i guess i can try that. thanks!
theothornhill has joined #commonlisp
<fe[nl]ix> NotThatRPG: what's the problem exactly ? that you can't M-. a Fiveam test ?
<NotThatRPG> Yep.
clhelp has quit [Client Quit]
<lisp123> clhelp: I would avoid ... ehhh too late already left
clhelp has joined #commonlisp
<lisp123> clhelp: I would avoid playing around with reader macros too much tbh
rotateq has quit [Read error: Connection reset by peer]
rotateq has joined #commonlisp
clhelp80 has joined #commonlisp
cage has joined #commonlisp
<clhelp80> (ack, my network is spotty...)
<clhelp80> well, thanks for the help-- seeya!
clhelp80 has quit [Client Quit]
clhelp has quit [Client Quit]
Cymew has joined #commonlisp
lisp123 has quit [Quit: Leaving...]
Cymew has quit [Ping timeout: 256 seconds]
treflip has quit [Quit: good night]
theothornhill has quit [Remote host closed the connection]
xaltsc has joined #commonlisp
theothornhill has joined #commonlisp
theothornhill has quit [Remote host closed the connection]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
Algernon666 has quit [Ping timeout: 245 seconds]
theothornhill has joined #commonlisp
varjag has joined #commonlisp
karlosz has joined #commonlisp
tfeb has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
karlosz has quit [Quit: karlosz]
tfeb has quit [Quit: died]
karlosz has joined #commonlisp
<_death> you can use list*
theothornhill has quit [Remote host closed the connection]
MichaelRaskin has joined #commonlisp
abrantesasf has joined #commonlisp
<Guest74> anybody know what format puri takes for :query?
Lord_of_Life has quit [Quit: Laa shay'a waqi'un moutlaq bale kouloun moumkine]
<Guest74> nevermind, seems it has no facility to build queries. quri it is. Would have been nice to use quri as drakma accepts that.
<kagevf> semz: parenscript is a sub-set of CL that produces javascript
<Guest74> any reasons to prefer drakma over dexador?
dre has joined #commonlisp
<jackdaniel> it has a cooler name
<jackdaniel> on top of that it has a good documentation and (most likely) its source code is more readable / hackable (knowing both authors style)
tyson2 has joined #commonlisp
Oladon has joined #commonlisp
<Guest74> I actually don't see anything wrong with the dexador documentation.
<Guest74> source seems fine.
<Guest74> Anyways, if anybody knows any real issues I'll read the logs. Seems easier to use with easier query construction with quri.
Guest74 has quit [Quit: Connection closed]
gaqwas has quit [Ping timeout: 252 seconds]
cosimone has quit [Remote host closed the connection]
cosimone has joined #commonlisp
kennyd has joined #commonlisp
theothornhill has joined #commonlisp
<etimmons> I'd leave a memo for Guest74, but alas, who knows what nick he/she/it will have when they return.
<jackdaniel> I think that they'll read the log, so if you know any real issues then go ahead ,)
<yitzi> Guest74 is probably the Skynet precursor for all we know.
<etimmons> Guest74: If you use Dexador, be aware that the built in connection pool can break things. If you ever get weird behavior, that's the first thing to disable.
<etimmons> jackdaniel: I know, I just think that occasional prods to use a registrered nick if you're going to be hanging around are good :)
<etimmons> Or at the very least an unregistered nick that isn't autoassigned by the web gateway
<jackdaniel> I share that view, that's why I have a registered nick
varjag has quit [Ping timeout: 256 seconds]
karlosz has quit [Quit: karlosz]
aartaka has quit [Ping timeout: 252 seconds]
aartaka has joined #commonlisp
gaqwas has joined #commonlisp
<dre> how did I come up with "(car (nthcdr idx list))" before I found (nth idx list)
nature has quit [Ping timeout: 252 seconds]
<adlai> is there any better place for live-investigating a CCL image that crashed to LDB?
theothornhill has quit [Remote host closed the connection]
* adlai notes that #ccl in this network does have several regulars, although the channel back in freenode was quite a ghost town, and this one has no /topic set
Lord_of_Life has joined #commonlisp
<adlai> since it is less on-topic here, I'll take my notes to there, unless someone finds that this is specifically a desirable topic for the general channel.
<dre> Well I find this /generally/ desirable
<dre> for this specific channel :)
cage has quit [Remote host closed the connection]
cage has joined #commonlisp
<adlai> I agree that it does have relevance, because I'm hoping to identify which abstraction is problematic. my code uses lots of unstandardized things (networking, multiprocessing)
<adlai> arguably FFI should be included separately in that list, since cl+ssl is an FFI binding, and 'networking' alone could be done without writing FFI bindings beyond what the implementation already provides.
<adlai> minion: memo for Guest74: if you are parsing JSON that represents objects with structures known in advance, i.e. pretty much anything more specific than arbitrary prototype soup, you may find CL-JSON's hooking mechanisms useful
<minion> Remembered. I'll tell Guest74 when he/she/it next speaks.
* adlai did some bits of premature-optimisation where in certain parsing invocations, the numerical parser is replaced with more specific ones, to save the troubles of coercing parsed floats
drakonis has joined #commonlisp
tyson2 has quit [Ping timeout: 256 seconds]
Lycurgus has joined #commonlisp
_73 has quit [Remote host closed the connection]
pve has quit [Quit: leaving]
shka has quit [Ping timeout: 252 seconds]
cage has quit [Quit: rcirc on GNU Emacs 27.1]
Lycurgus has quit [Quit: Exeunt]
_73 has joined #commonlisp
ec_ has joined #commonlisp
aeth has quit [Ping timeout: 256 seconds]
aeth has joined #commonlisp
Algernon69 has joined #commonlisp
<dre> :woot: :woot:
pdietz has quit [Quit: Client closed]
<hayley> You could use (count #\1 binary-list) to count all the ones in a list.
<dre> hayley, how would that form work for "counting-per-columns" though. I'm not getting it
<dre> I don't get the 3 mapcar deep bit either, but that gives me the answer I want :P
<hayley> I was thinking of count-ones-per-position.
<dre> does it really count per-position?
<dre> ...
<Bike> as in (mapcar (lambda (sl) (count #\1 sl)) binary-list)
<dre> but that counts across the binary-value.
* hayley reads the example more carefully
<Bike> upon further examination i can't actually tell what this is supposed to do. should it not be ((1 0 1) (1 1 1) (0 0 1)) => (2 3 1)?
<dre> I don't want (2 3 1) i want (2 1 3) --. there's 2 in the first column, 1 in the middle column, and 3 in the last column
<hayley> Yes, the counts are for the nth position of each list, where n is natural. e.g. ((1 0 1) (1 1 1) (0 0 1)) => (2 1 3) per the documentation.
ec_ has quit [Remote host closed the connection]
<dre> if I do (count t '(( t nil t) (nil t t))) in the repl, I get 0
<Bike> oh, like the transpose. ok.
<dre> Bike, i did look up transpose to begin with but couldn't find what I was looking for
<hayley> Never mind then.
<dre> transpose would be much easier as well, because then we could do the lambda.
<dre> where's the count documentation?
<Bike> clhs count
<hayley> .oO(Guess I need to learn more APL and April then.)
<dre> I feel like "COUNTS" or something would be a useful solution, i was suprised that there wasn't something nicer in sbcl by default
<Bike> (mapcar (lambda (sl) (count #\1 sl)) (transpose '((1 0 1) (1 1 1) (0 0 1)))) => (2 1 3), but that's not really much clearer
<dre> ah no, i think transpose is much clearer than mine.
<Bike> where (defun transpose (list) (apply #'mapcar #'list list))
<dre> ah yes right, you've got to defun transpose first
_73 has quit [Remote host closed the connection]
<dre> i think it's still clearer. it labels it as a "transpose" function that someone can intuitively get.
gaqwas has quit [Ping timeout: 256 seconds]
<dre> thanks Bike , much much nicer.
<hayley> One nitpick: A compliment is something you give to a nice person, and a complement is the "opposite" of a value.
Oladon has quit [Quit: Leaving.]
<dre> I want to compliment the binaries, they're doing a great job :)
<dre> (thanks)
_73 has joined #commonlisp
<NotThatRPG> @adlai: A library that grokked JSON Schema would be A Good Thing.
waleee has quit [Ping timeout: 268 seconds]
waleee has joined #commonlisp
_73 has quit [Remote host closed the connection]
<Gnuxie> no that isn't the sequel
<Gnuxie> stop posting it it's cringe
<hayley> What do you know, you didn't write it or anything. /s
<hayley> Okay, the latter is not the sequel.
tyson2 has joined #commonlisp
cranium has quit [Quit: Leaving]
igemnace has quit [Ping timeout: 252 seconds]
Guest74 has joined #commonlisp
NotThatRPG has quit [Ping timeout: 256 seconds]
<Guest74> etimmons: good to know. Just using it for accessing web apis right now.
<minion> Guest74, memo from adlai: if you are parsing JSON that represents objects with structures known in advance, i.e. pretty much anything more specific than arbitrary prototype soup, you may find CL-JSON's hooking mechanisms useful
aartaka has quit [Ping timeout: 256 seconds]
<Guest74> adlai: I'll take a closer look then. I had decided on jsown just because of speed, amount of consing, and ease of destructuring to make structures. But if i can parse directly into the objects that might be more useful.
<adlai> cl-json has a rather coarse granularity for the hooks, although then again, JSON itself doesn't have that many types to begin with
<Guest74> I've just been using destructuring bind and then making structs. Which is actually quite simple.
<adlai> sure, and generational GCs will make the temporary consing irrelevant
<adlai> there are cases where parsing is the bottleneck, and the hooks are useful; or if you have some strange numerical imposition, e.g. you want all numbers returned by the parser to already be complexes
<Guest74> numbers is the only problem I see with jsown right now. I don't understand why it returns rationals.
<Guest74> I should probably look at the documentation.
<adlai> why is that a problem?
<Guest74> just extra work and wondering why it's different than all the others.
Algernon69 has quit [Ping timeout: 245 seconds]
<Guest74> so I've noticed i can do (destructuring-bind (_ _ _ fourth fifth)'(1 2 3 4 5) (do-something)) and it doesn't complain about multiple occurences of _, but it does if you do it in a defun. Where is this difference discussed in clhs?
igemnace has joined #commonlisp
<adlai> iirc, the JSON specification does not define much about numbers, beyond that they can be integers, or have a decimal point. so CL:RATIONAL actually is the sane choice, in the absence of extra information making the choice subtype a sane one.
<adlai> clhs destructuring-bind
<adlai> I think some of the possible macroexpansions would not require warnings.
<adlai> e.g., a naive implementation that walks the tree of names to bind, collecting accessors, and then builds a bunch of nested LET statements, one per binding.
<Guest74> ah, i read that wrong earlier. I thought it said the lambda lists were not like macro lambda lists.
<adlai> destructuring-bind isn't one of the defining operators, so I'd not expect it to be a strict, either
amb007 has quit [Ping timeout: 252 seconds]
<Guest74> Is it bad style to do something like that for ignoring things. I find it more legible.
<adlai> it's considered rude to do this to a single-character token without also publishing an emacs face customization mode that adjusts alpha
cosimone has quit [Ping timeout: 268 seconds]
<Guest74> I'm assuming that's some sort of emacs joke? Should have just waited till Beach: was awake :)
abrantesasf has quit [Remote host closed the connection]
<adlai> yes, there's an emacs mode that I find myself missing already in my new setup, called paren-face, that let you mess around with shading and transparency of the various parentheses.
abrantesasf has joined #commonlisp
<adlai> for a while in my early days I experimented with simply making them all, almost invisible; this was not a good idea.
abrahms has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
abrahms has joined #commonlisp
<Guest74> I've thought about getting rid of them altogether. With each new parens making a new coloured block. I haven't implemented it yet to see how annoying or unusable it would be.
<adlai> I recall my favorite setup being that they were all more similar to the background, although there was some grading that depended on nesting level, and in some circumstances, highlighting of a matching delimeter.
abrahms66 has joined #commonlisp
<adlai> however, it's dangerous to leave something like that enabled by default e.g. in the repl mode, because you might crash emacs, or just search for an indefinite matching delimiter
<Guest74> oh, not thinking about emacs. Just the graphical representation of sexps. Want to eventually get rid of emacs.
abrahms has quit [Ping timeout: 256 seconds]
abrantesasf has quit [Remote host closed the connection]
<adlai> it's a more general problem, emacs is simply the usual suspect for this kind of issue.
<Guest74> these are just representations, the underlying data always remains the same.
Colt has quit [Quit: Leaving]
<kagevf> Guest74: I've had problems using cl-json with boolean "false" ... not a deal-breaker (for me) but something to be aware of
Colt has joined #commonlisp
<Guest74> I think most have problems with that no? Probably not a big deal for getting the weather.
<kagevf> oh, IDK ... I've only used cl-json so far