Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
elderK has joined #commonlisp
karlosz_ has joined #commonlisp
<elderK>
Hey guys, how would you create a custom integer type in Common Lisp? Like, in C++, you just create a struct and you know, your methods and the raw integer you're wrapping: You'd pass it by value and stuff and things are good since it's a tiny simple type.
<elderK>
But wouldn't that always mean that an instance of that type is always on the heap? Is the distinction between heap and stack even relevant in Lisp?
<elderK>
How would you do something similar in Lisp? Is it even possible? I figure I could use defstruct or defclass to define a wrapper type. That way, you know, it could be abstracted and I could dispatch on that type in methods and stuff.
<elderK>
As an extension to this question: If I'm doing integer arithmetic, how do I make sure that it's all fixnum arithmetic within certain bounds? Say, I always want to work on a 64bit unsigned integer: no ifs and buts, always that and no more.
<elderK>
In the past when I worked with raw integers, it seemed kind of hard to make sure that they didn't become "arbirtrarily sized."
<elderK>
Thanks a bunch in advance :)
karlosz has quit [Ping timeout: 246 seconds]
karlosz_ is now known as karlosz
<White_Flame>
there's the built-in class FIXNUM, which should fit in a machine word
<White_Flame>
but if you want wrapped math, you need to manually do that with (logand #xffffffffffffffff ...) or whatever appropriate
<White_Flame>
the respective type would be (unsigned-byte 64) to list the number of bits, or (integer 0 9999) for some range
<White_Flame>
and if you need an object around that to do very specific class dispatch, then yeah, defclass it
<White_Flame>
the lowest overhead wrapper is usually a cons cell, if you don't need to care about the type that it carries
<White_Flame>
that way passing around the cons cell is equivalent to "pass by reference" of mutating that slot
<elderK>
Okay, cool.
<elderK>
Another question I have is how we emulate things like pointers in C. Sometimes it is convenient to say, pass the address of a variable or a struct's member. It can make for concise code sometimes.
<elderK>
I imagine that's not possible in CL unless the "function" you're calling is really a macro that setfs the parameter, but even then, that's not a real pointer style thing.
<elderK>
Another alternative I can see is using "boxes" for stuff that you want to be able to pass around as if it were a pointer but that obviously has a cost.
<elderK>
Most of the situations I am thinking about this for, can be written to not require it so it's not a killer.
<elderK>
When it comes to creating instances of classes and stuff, I imagine SBCL or whatever CL compiler is pretty smart when it comes to allocating them. I figure it does analysis and can determine when they should live on the stack or in the heap.
<elderK>
I remember long ago about there being a way to force allocation on the stack: Is that possible and how do you know when it is desirable?
<paulapatience>
Declare dynamic-extent on sbcl
<hayley>
(lambda (value) (setf place value))
NotThatRPG has quit [Remote host closed the connection]
NotThatRPG has joined #commonlisp
<paulapatience>
Section 6.2 of the SBCL manual discusses dynamic extent and stack allocation
<elderK>
paulapatience: Thank you.
<elderK>
hayley: That's the same as boxing if you want to use the closure like a pointer.
<hayley>
I'm not sure what you mean by "boxing". The site of the definition doesn't get affected; usually the compiler will manage boxing for closures auto-magically.
<White_Flame>
elderK: the term you're looking for relating member slot pointers is "locative", which haven't been supported much
<White_Flame>
nowadays it would be the equivalent of a getter/setter pair of closures
<White_Flame>
and there are libs for wrapping that
<elderK>
Cool. Thank you.
<elderK>
So, for instance, if we had a box, we could alter whatever the box is "wrapping" but also make the box wrap something "else."
<elderK>
hayley: I'm probably misusing a term I learned from "Lisp in Small Pieces." The idea is that we wrap the thing we want to indirectly access in some way, in a way that can be mutated how we want it to be mutated.
<elderK>
In essence, it's the same as using lambda and stuff.
<White_Flame>
note that I don't think I've ever had to use a locative/slot-pointer in CL
<White_Flame>
you can probably find a higher abstraction than exposing that level of access
<elderK>
Aye :)
eddof13 has joined #commonlisp
eddof13 has quit [Client Quit]
karlosz has quit [Quit: karlosz]
occ has joined #commonlisp
karlosz has joined #commonlisp
Oladon has joined #commonlisp
shka has quit [Ping timeout: 246 seconds]
random-nick has quit [Ping timeout: 248 seconds]
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
robin has quit [Read error: Connection reset by peer]
waleee has quit [Quit: WeeChat 3.8]
waleee has joined #commonlisp
karlosz has quit [Read error: Connection reset by peer]
tyson2 has quit [Read error: Connection reset by peer]
Prokhor_ has quit [Ping timeout: 248 seconds]
occ has quit [Ping timeout: 252 seconds]
prokhor has joined #commonlisp
pillton has joined #commonlisp
bilegeek has quit [Quit: Leaving]
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
robin has quit [Read error: Connection reset by peer]
peterhil has quit [Quit: WeeChat 3.8]
occ has joined #commonlisp
Everything has quit [Quit: leaving]
jeosol has quit [Quit: Client closed]
pillton has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.2)]
pfd has joined #commonlisp
azimut has quit [Ping timeout: 255 seconds]
elderK has quit [Quit: Connection closed for inactivity]
marsia has quit [Ping timeout: 252 seconds]
masinter has quit [Remote host closed the connection]
marsia has joined #commonlisp
X-Scale has joined #commonlisp
marsia has quit [Ping timeout: 246 seconds]
<nytpu>
hmm, after the SBCL 2.3.0 update (presumably), `ql:quickload`ing systems through SWANK/Vlime indefinitely hangs. quickloading works fine in a normal repl, and everything else through SWANK seems to works fine still
marsia has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
<nytpu>
huh, that's very strange, something like `(ql:quickload :alexandria :silent t)` works fine, it's only when Quicklisp tries printing anything that it hangs. printing stuff outside of however Quicklisp is doing it seems fine afaict so i can't really tell what the issue could be...
<beach>
You could try setting *PRINT-CIRCLE* to a true value. I have mine set by default.
<nytpu>
*PRINT-CIRCLE* didn't help, which i suspected because quickloading still works fine in outside of SWANK in a normal repl
marsia has quit [Ping timeout: 260 seconds]
<nytpu>
huh, looks like it's the new quicklisp dist becuase i downgraded that and now it works fine
<nytpu>
so maybe it's something with a new version of SWANK that got added because those are the only systems Vlime/SWANK loads on startup that got updated
waleee has quit [Ping timeout: 252 seconds]
marsia has joined #commonlisp
scymtym_ has quit [Ping timeout: 246 seconds]
Brucio-61 has quit [Ping timeout: 260 seconds]
silasfox has joined #commonlisp
igemnace has joined #commonlisp
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
Brucio-61 has joined #commonlisp
Lumine has joined #commonlisp
ttree has quit [Ping timeout: 255 seconds]
Brucio-61 has quit [Ping timeout: 260 seconds]
Cymew has joined #commonlisp
Lycurgus has joined #commonlisp
kenran has joined #commonlisp
robin has joined #commonlisp
pve has joined #commonlisp
Lycurgus has quit [Quit: Exeunt: personae.ai-integration.biz]
pfd has quit [Quit: Client closed]
rgherdt has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
LW has joined #commonlisp
elderK has joined #commonlisp
<pve>
I'm finding it quite hard to design my protocol to be sufficiently flexible with respect to extensibility. At every step I ask myself "well, but what if one wanted to do *this*, or *that*" and just end up paralyzed and get nothing done. :)
<pve>
Feels like there has to be a better way to prune the search space.
MajorBiscuit has joined #commonlisp
inline__ has quit [Quit: Leaving]
yvm has joined #commonlisp
occ has quit [Ping timeout: 255 seconds]
<splittist>
pve: (A) How about telling yourself you're not trying to solve the problem all at once, but just trying to 'launch' with a 'minimum viable protocol'. (B) Many short generic functions - i.e. splitting up the processing into many layers / pieces - is often the right way to go; but if you can't think of a sensible name for such a function, that might be an indication that making it available for 'extensibility' isn't relevant or
<splittist>
important.
<splittist>
Thank you for attending my TED talk...
<beach>
It is also often easier to start with the types (usually classes) involved, and then think of the operations needed later.
<elderK>
Hey, I was wondering if anyone here uses Paredit with Sly on Emacs: Just wondering if they had to remap "RET."
shka has joined #commonlisp
X-Scale has quit [Quit: Client closed]
jmdaemon has quit [Ping timeout: 246 seconds]
azimut has joined #commonlisp
<pve>
splittist: thank you for giving one, I'll take all the help I can get :)
<pjb>
elderK: note: it would be quite difficult to integrate a new numeric type in the existing types, while ensuring all the assertions surrounding them. For example, clisp has variable-length long-floats (the user can set the length of the long-floats at any time), and this has as consequences that CL:PI is rebound to a new long-float each time, hence it's constant variable whose value CHANGES!
<ixelp>
Pascal Bourguignon's Usenet posts of interest
<pjb>
pve: you cannot plan for all potential extensions ever.
<pjb>
pve: planing for some (probable) extensions is already good. Using OOP with a good class structure is often enough. Remember, in CLOS we have :before :after and :around methods to add extensions to existing methods without even having to subclass.
<pjb>
pve: in case of protocols, having a version and some feature negociation mechanism, should be sufficient.
<boigahs_>
Zawinski's Law states that every program expands until it reads mail, so perhaps it is possible if you can identify the route there sufficiently :)
<pjb>
:depends-on (:cl-pop …) so it's fulfilled already. :-)
<elderK>
I don't know much about ChatGPT: How could it help?
<hayley>
It can write crappy code for you.
<elderK>
I'm good :P I don't need ChatGPT :)
<boigahs_>
I can write crappy code just fine thank you
rogersm has joined #commonlisp
karlosz has joined #commonlisp
<phoe>
Zawinski's law reimagined for 21st century: every program expands until it has discord integration and facebook trackers
<hayley>
Can confirm, I added a crappy Discord webhook to my benchmark harness, so I could check the status on my phone.
<pve>
pjb: yeah, I think I might make one concrete implementation first (it's simple enough) and then take it from there
samebchase has quit [Quit: Ping timeout (120 seconds)]
samebchase has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
samebchase5 has joined #commonlisp
samebchase has quit [Ping timeout: 252 seconds]
samebchase5 is now known as samebchase
karlosz has quit [Quit: karlosz]
<pjb>
elderK: for now, indeed, a good programmer will work faster than you could coerce chatgpt produce something valid. That said, I think it's still worth it learning to use it, because on domains where you're not expert, 1- it can provide information you couldn't easily get otherwise (eg. compared with google searches). 2- soon enough it will be merged with a reasoning AI, and become actually useful, so our job will be to drive it.
Krystof has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
<pjb>
pve: asking users, you may get ideas for future extensions, so you may plan for them.
kenran has quit [Remote host closed the connection]
glaucon has joined #commonlisp
pjb has quit [Read error: Connection reset by peer]
rgherdt has quit [Ping timeout: 248 seconds]
rgherdt has joined #commonlisp
pjb has joined #commonlisp
pjb is now known as Guest2082
pjb has joined #commonlisp
Guest2082 has quit [Ping timeout: 248 seconds]
pjb has quit [Ping timeout: 246 seconds]
pjb has joined #commonlisp
glaucon has quit [Quit: Leaving.]
Alfr has quit [Remote host closed the connection]
Alfr has joined #commonlisp
pjb has quit [Ping timeout: 264 seconds]
elderK has quit [Quit: Connection closed for inactivity]
glaucon has joined #commonlisp
rgherdt_ has joined #commonlisp
rgherdt has quit [Ping timeout: 248 seconds]
anticomputer has quit [Remote host closed the connection]
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
anticomputer has joined #commonlisp
rgherdt_ has quit [Ping timeout: 248 seconds]
rgherdt has joined #commonlisp
eddof13 has joined #commonlisp
rgherdt has quit [Ping timeout: 252 seconds]
rgherdt has joined #commonlisp
silasfox has quit [Read error: Connection reset by peer]
silasfox has joined #commonlisp
tyson2 has joined #commonlisp
dlowe has joined #commonlisp
<beach>
I am working on Second Climacs, and I am trying to add features to it that I depend on in SLIME, with the objective of getting Second Climacs good enough for my own development. One obvious thing I was thinking of was slime-compile-defun (C-c C-c) which I use a lot.
<beach>
But then I started thinking about the use case for slime-compile-defun, and I was no longer so sure it will be required in Second Climacs. So I would like some input to understand how people use SLIME (or Sly) commands for compiling a top-level form. Thanks in advance!
gxt has quit [Ping timeout: 255 seconds]
<beach>
Let's say that there was only a compile-buffer command available.
gxt has joined #commonlisp
karlosz has joined #commonlisp
<phoe>
why would it not be required?
karlosz has quit [Remote host closed the connection]
<phoe>
I have C-c C-c in my muscle memory for compile-and-loading single lisp forms in emacs
<beach>
So I guess the question is: If there were only a compile-buffer command, what would you miss in compile-defun?
karlosz has joined #commonlisp
<phoe>
like, I don't need or want to redo the whole buffer each and every time
<beach>
phoe: Yes, I have that too.
<phoe>
assume I have a buffer full of commands that are meant to be evaluated separately, not as a file
<beach>
Ah, yes, I can see that one.
<yitzi>
compile-defun seems like a quick way to do compile-region.
<beach>
The use case for now is a buffer that is meant to be compiled as a file at some point.
<phoe>
the author of that video writes scratch code in a buffer and then writes (or modifies) individual forms before sending them for (re)evaluation
<beach>
OK, fair enough.
<beach>
Thanks. (I should have asked the question differently, but too late)
Brucio-61 has joined #commonlisp
jmdaemon has joined #commonlisp
NotThatRPG has joined #commonlisp
azimut_ has joined #commonlisp
azimut has quit [Ping timeout: 255 seconds]
emanuele6 has quit [Quit: WeeChat 3.8]
emanuele6 has joined #commonlisp
<Bike>
i sometimes start rewriting code in such a way that it's halfway done, and compiling a buffer would hit read errors and such, but i want to test some function i have a complete rewrite of individually
<Bike>
so i'd like to compile parts of buffers for that purpose
<beach>
Yes, I see.
<beach>
By "test some function", you mean invoking it with some arguments at the REPL, right?
<Bike>
Right
<Bike>
I mean, also seeing if there are any warnings/errors from the compiler, but ultimately running it yes
<Josh_2>
beach: I rarely compile the entire file, instead I use C-c C-c
<beach>
That's the use case I had imagined. The thing is that the plan for Second Climacs is to give warnings and syntax errors at typing speed, so that aspect is no longer necessary.
<beach>
Josh_2: Yes, me too, but that's not what I was asking.
<Josh_2>
In fact I can't remember the last time I used C-c C-k
<beach>
Josh_2: Same here, but that's not what I was asking either.
<Josh_2>
I would be unimpressed if I only had a full file command as sometimes things are half done and you are trying to compile incrementally
<beach>
I'll think of a better way to ask the question at some point later.
<Josh_2>
Normal example is half complete GF's with missing parens while I rejig a previous class definition
pfd has joined #commonlisp
dlowe has quit [Ping timeout: 260 seconds]
<Josh_2>
Basically what Bike said
pfd has quit [Client Quit]
azimut_ has quit [Ping timeout: 255 seconds]
azimut has joined #commonlisp
silasfox has quit [Quit: ERC (IRC client for Emacs 26.3)]
<mariari>
is there a #+ for different versions of say sbcl?
karlosz has quit [Quit: karlosz]
karlosz has joined #commonlisp
<beach>
mariari: I recommend you read Krystof's paper about how to use read-time conditionals.
karlosz has quit [Client Quit]
karlosz has joined #commonlisp
karlosz has quit [Read error: Connection reset by peer]
<jackdaniel>
based on the url you should thank jesus ;p no problem though :)
cage has joined #commonlisp
jmdaemon has joined #commonlisp
<Josh_2>
I dont think I've ever used #- or #+ :O
<Josh_2>
So much of the differences between implementation is hidden by compat libraries that make use of it them :joy:
karlosz has quit [Read error: Connection reset by peer]
karlosz has joined #commonlisp
karlosz has quit [Client Quit]
emanuele6 has quit [Ping timeout: 255 seconds]
karlosz has joined #commonlisp
karlosz has quit [Read error: Connection reset by peer]
karlosz has joined #commonlisp
robin has quit [Read error: Connection reset by peer]
Lumine has quit [Quit: o/]
ec has quit [Ping timeout: 255 seconds]
morganw has joined #commonlisp
ec has joined #commonlisp
<pjb>
Josh_2: #+/#- can be used for other things than just implementation differences.
karlosz has quit [Ping timeout: 246 seconds]
Guest2942 has joined #commonlisp
Guest2942 has quit [Client Quit]
karlosz has joined #commonlisp
robin has joined #commonlisp
<ober>
thanks again for the help Shinmera things are twice as fast with shasht
<Shinmera>
Sure
robin has quit [Remote host closed the connection]
Lord_of_Life has quit [Ping timeout: 255 seconds]
Lord_of_Life has joined #commonlisp
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
kdlv has joined #commonlisp
MajorBiscuit has quit [Quit: WeeChat 3.6]
jmdaemon has quit [Ping timeout: 248 seconds]
Oladon has joined #commonlisp
emanuele6 has joined #commonlisp
jon_atack has quit [Quit: WeeChat 3.8]
frgo has joined #commonlisp
dlowe has joined #commonlisp
robin has joined #commonlisp
jmdaemon has joined #commonlisp
karlosz has quit [Quit: karlosz]
karlosz has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
robin has quit [Read error: Connection reset by peer]
karlosz has quit [Ping timeout: 248 seconds]
jonatack has joined #commonlisp
eddof13 has joined #commonlisp
<Josh_2>
I cannot seem to update a UUID column in postgres using s-sql :sob:
<Josh_2>
Has anyone done this?
<Josh_2>
Oh
<Josh_2>
maybe I got it to work
<Josh_2>
Yep, how annoying. When I insert into database using my yesql prepared statement I have to convert to a byte array, but when I update the column I have to use a string represenation :facepalm:
ttree has joined #commonlisp
attila_lendvai has joined #commonlisp
waleee has joined #commonlisp
karlosz has joined #commonlisp
karlosz has quit [Client Quit]
karlosz has joined #commonlisp
X-Scale has joined #commonlisp
Alfr has quit [Quit: Leaving]
varjag has joined #commonlisp
skyl4rk` is now known as skyl4rk
bitmapper has joined #commonlisp
Guest63 has joined #commonlisp
Lumine has joined #commonlisp
son0p has quit [Ping timeout: 252 seconds]
Brucio-61 has quit [Ping timeout: 260 seconds]
dlowe has quit [Ping timeout: 248 seconds]
Guest63 has quit [Quit: Client closed]
tyson2 has quit [Remote host closed the connection]
Brucio-61 has joined #commonlisp
hineios has quit [Read error: Connection reset by peer]
igemnace has quit [Remote host closed the connection]
Lumine has quit [Quit: bbl]
hineios has joined #commonlisp
hineios has quit [Client Quit]
hineios has joined #commonlisp
X-Scale has quit [Quit: Client closed]
karlosz has quit [Ping timeout: 246 seconds]
karlosz has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kenran` has joined #commonlisp
kenran` has quit [Remote host closed the connection]
eddof13 has joined #commonlisp
kenran has quit [Ping timeout: 252 seconds]
<Josh_2>
SLOC line go up!
karlosz has quit [Read error: Connection reset by peer]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Inline has joined #commonlisp
glaucon has quit [Read error: Connection reset by peer]
eddof13 has joined #commonlisp
Lumine has joined #commonlisp
amoroso has quit [Quit: Client closed]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Brucio-61 has quit [Remote host closed the connection]
Brucio-61 has joined #commonlisp
_cymew_ has quit [Ping timeout: 252 seconds]
tyson2 has quit [Remote host closed the connection]
Lumine has quit [Ping timeout: 246 seconds]
<jcowan>
beach: The Yiddish verb khazern 'repeat in order to learn' is borrowed from the Hebrew verb khazar 'return; repeat', plus the Germanic infinitive ending '-en'.
<_death>
then you'd expect the Yiddish to use "s" and not "z", i.e. khasern
robin has joined #commonlisp
eddof13 has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<_death>
(to be clear, the pronunciation is phonetic "z")
<Josh_2>
khazar milkers
LW has quit [Quit: WeeChat 3.6]
akoana has joined #commonlisp
<_death>
in hebrew "techspeak", "loop" would be "lula'a", which apparently is translates to various yiddish words like "eugel" (guess from hebrew circle, igul), "petlye" (tie?), "knaplach"/"knup" (seems like button, german knopf), schleif (like german, schleife).. anyway, seems off topic :)
karlosz has joined #commonlisp
karlosz has quit [Client Quit]
<Josh_2>
Why would someone use (defmethod no-applicable-method ..) over say just providing a default method with a condition :thinking:
karlosz has joined #commonlisp
<Josh_2>
*that signals a condition
<Josh_2>
hmm I guess from a lispy perspective you can inform the user that they need to specialize their own method :thinking:
karlosz has quit [Read error: Connection reset by peer]
pve has quit [Quit: leaving]
<jcowan>
_death: Yiddish transcription into Latin letters normally uses "z" for /z/; Yiddish is not spelled like German
<_death>
Josh_2: I guess to emphasize that it's not a default method, i.e. one that you'd typically expect on call-next-method or adorn with :before/:after/:around
<jcowan>
that is, uses "z" for the letter zayn
<_death>
jcowan: I see.. didn't expect this
<Josh_2>
Thanks _death
rgherdt has quit [Remote host closed the connection]
<jcowan>
When Singer sewing machines came to Eastern Europe, Jews understood the name to be /zinger/ and not /singer/ (as it is in English), so they assumed that /s/ was used to write the z-sound. Why is why Азимов's name became "Asimov" in the U.S. instead of "Azimov"
karlosz has joined #commonlisp
frgo_ has joined #commonlisp
karlosz has quit [Client Quit]
frgo has quit [Ping timeout: 255 seconds]
karlosz has joined #commonlisp
shka has quit [Ping timeout: 246 seconds]
<Josh_2>
You know what this is
<Josh_2>
its off topic
tyson2 has joined #commonlisp
<_death>
we say zinger/asimov.. wikipedia says Isaac Singer had German ancestry (and "né Reisinger") so the z makes sense.. Asimov case is indeed strange (but hebrew wikipedia entry mentions yiddish name with z).. anyway, night ;)
karlosz has quit [Ping timeout: 255 seconds]
karlosz has joined #commonlisp
<Josh_2>
I have become a big fan of using #.(docstring generator) over just writing a docstring, its much neater
<Josh_2>
Plus I can enforce my own docstring styles on myself :joy:
karlosz has quit [Ping timeout: 260 seconds]
bitmapper has quit [Quit: Connection closed for inactivity]
jeosol has joined #commonlisp
karlosz has joined #commonlisp
karlosz has quit [Ping timeout: 248 seconds]
karlosz has joined #commonlisp
karlosz has quit [Quit: karlosz]
karlosz has joined #commonlisp
<pjb>
Josh_2: I wanted to use that too. The idea being that you provide docstrings for run-time (REPL) use, but that the docstring is not necessarily readable in the source itself. In that case, you could as well add the docstrings using (setf documentation) in a separate file, as beach does.