abrantesasf has quit [Remote host closed the connection]
hashfunc1ebd has joined #commonlisp
<hashfunc1ebd>
how do i zero-pad a hexadecimal number with format?
<hashfunc1ebd>
i've attempted to by the following: (FORMAT NIL "~8,'0X" (WRITE-TO-STRING #X0009E667 :BASE 16))
<hashfunc1ebd>
but this returns: => "9E667"
<hashfunc1ebd>
when i would like it to return: => "0009E667"
<semz>
~X formats integers. You are passing it a string.
<semz>
The write-to-string call is unnecessary
<beach>
I would expect it to be wrong even.
<hashfunc1ebd>
semz: that worked perfectly. thanks semz
<beach>
I wonder why there is no error signaled.
<beach>
... in SBCL I mean.
<hashfunc1ebd>
yeah i'm using SBCL; no error was signaled when attempting the former
<beach>
Right. I tried giving a string to that FORMAT directive and no error was signaled.
<mfiano>
No error is signaled on a few other implementations I tried either.
<semz>
"If arg is not an integer, it is printed in ~A format and decimal base." as per ~D (which ~X references)
<semz>
surprising
<beach>
Yeah.
<semz>
I guess it makes sense from the pov that many of these directives just adjust the printer variables
pollock has joined #commonlisp
abrantesasf has joined #commonlisp
abrantesasf has quit [Remote host closed the connection]
les has quit [Quit: Adios]
les has joined #commonlisp
semz_ has joined #commonlisp
semz has quit [Ping timeout: 260 seconds]
les has quit [Client Quit]
les has joined #commonlisp
semz_ is now known as semz
les has quit [Client Quit]
les has joined #commonlisp
mfiano has quit [Quit: WeeChat 3.4.1]
zacts has joined #commonlisp
slowButPresent has quit [Quit: leaving]
mfiano has joined #commonlisp
zacts is now known as z4kz
z4kz has quit [Quit: Client closed]
tyson2 has quit [Remote host closed the connection]
karlosz has joined #commonlisp
karlosz has quit [Quit: karlosz]
Guest77 has joined #commonlisp
pollock has quit [Remote host closed the connection]
rotateq has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)]
Guest77 has quit [Quit: Client closed]
yauhsien has joined #commonlisp
yauhsien has quit [Ping timeout: 240 seconds]
Oladon has joined #commonlisp
karlosz has joined #commonlisp
karlosz has quit [Quit: karlosz]
admich1 has joined #commonlisp
azimut has quit [Ping timeout: 240 seconds]
hashfunc1ebd has quit [Ping timeout: 250 seconds]
aartaka has joined #commonlisp
arm has joined #commonlisp
arm has left #commonlisp [#commonlisp]
shka has joined #commonlisp
rotateq has joined #commonlisp
aeth has quit [Ping timeout: 276 seconds]
aeth has joined #commonlisp
Krystof has quit [Ping timeout: 240 seconds]
ttree has quit [Ping timeout: 240 seconds]
Krystof has joined #commonlisp
Oladon has quit [Quit: Leaving.]
attila_lendvai has joined #commonlisp
yauhsien has joined #commonlisp
attila_lendvai has quit [Ping timeout: 260 seconds]
yauhsien has quit [Ping timeout: 256 seconds]
admich1 has quit [Ping timeout: 276 seconds]
admich1 has joined #commonlisp
Inline__ is now known as Inline
admich1 has quit [Ping timeout: 272 seconds]
admich1 has joined #commonlisp
admich1 has quit [Read error: Connection reset by peer]
admich1 has joined #commonlisp
azimut has joined #commonlisp
admich1 has quit [Read error: Connection reset by peer]
admich1 has joined #commonlisp
Inline has quit [Quit: Leaving]
admich1 has quit [Read error: Connection reset by peer]
Inline has joined #commonlisp
admich1 has joined #commonlisp
kevingal has joined #commonlisp
Inline has quit [Quit: Leaving]
cosimone has quit [Ping timeout: 272 seconds]
cosimone has joined #commonlisp
Dynom has joined #commonlisp
xaotuk has joined #commonlisp
pjb has joined #commonlisp
cosimone has quit [Remote host closed the connection]
jmdaemon has quit [Ping timeout: 240 seconds]
drbluefall has quit [Quit: You have been kicked for being idle]
aeth has quit [Ping timeout: 276 seconds]
aeth has joined #commonlisp
<flip214>
If I define a structure with a BOA constructor, and then a derived structure (:INCLUDE foo), can I reuse the BOA constructor somehow?
<flip214>
I guess not easily, there's no CHANGE-CLASS for structures, and the BOA always returns the original type - so I need a separate BOA for the derived structure, right?
makomo has joined #commonlisp
makomo has quit [Client Quit]
makomo has joined #commonlisp
makomo has quit [Client Quit]
makomo has joined #commonlisp
yauhsien has joined #commonlisp
attila_lendvai has joined #commonlisp
yauhsien has quit [Ping timeout: 276 seconds]
attila_lendvai has quit [Ping timeout: 260 seconds]
ardon has joined #commonlisp
X-Scale` has joined #commonlisp
yauhsien has joined #commonlisp
X-Scale has quit [Ping timeout: 240 seconds]
X-Scale` is now known as X-Scale
zacque has quit [Quit: Goodbye :D]
treflip has joined #commonlisp
notzmv has quit [Ping timeout: 260 seconds]
attila_lendvai has joined #commonlisp
yauhsien has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
cosimone has joined #commonlisp
epolanski has joined #commonlisp
xaotuk has quit [Read error: Connection reset by peer]
yauhsien has quit [Ping timeout: 250 seconds]
yauhsien has joined #commonlisp
dre has quit [Ping timeout: 248 seconds]
yauhsien has quit [Ping timeout: 260 seconds]
<rotateq>
Nilby: Funny, our teacher has as another topic databases and told now no one wants to do it, so if it's fun for me this could be a good job option too later. :) As we talked about using CLSQL last week to have more flexibility and reliability.
rgherdt_ has joined #commonlisp
rgherdt has quit [Ping timeout: 272 seconds]
leeb has joined #commonlisp
zacts has joined #commonlisp
kevingal has quit [Ping timeout: 246 seconds]
Catie has quit [Ping timeout: 250 seconds]
zacts is now known as z4kz
yauhsien has joined #commonlisp
Everything has joined #commonlisp
lisp123 has joined #commonlisp
leeb has quit [Ping timeout: 272 seconds]
leeb has joined #commonlisp
yauhsien has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 276 seconds]
kevingal has joined #commonlisp
Lord_of_Life_ is now known as Lord_of_Life
yauhsien has quit [Ping timeout: 276 seconds]
admich1 has quit [Read error: Connection reset by peer]
admich1 has joined #commonlisp
ick has quit [Ping timeout: 246 seconds]
scymtym has quit [Ping timeout: 248 seconds]
<z4kz>
hello #commonlisp
Brucio-61 has quit [Ping timeout: 272 seconds]
<beach>
Hello z4kz.
lisp123 has quit [Quit: Leaving...]
Oddity has quit [Ping timeout: 240 seconds]
dre has joined #commonlisp
ardon has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.1.50)]
Brucio-61 has joined #commonlisp
scymtym has joined #commonlisp
abrantesasf has joined #commonlisp
admich1 has quit [Read error: Connection reset by peer]
abrantesasf has quit [Remote host closed the connection]
<flip214>
I'll just add another argument to a new DEFINE-BAR function, where a different constructor can be passed in (MAKE-FOO instead of MAKE-BAR)
admich1 has joined #commonlisp
xaotuk has joined #commonlisp
tyson2 has joined #commonlisp
lisp123 has joined #commonlisp
notzmv has joined #commonlisp
pranavats has left #commonlisp [#commonlisp]
kevingal has quit [Ping timeout: 272 seconds]
pranavats has joined #commonlisp
random-nick has joined #commonlisp
random-nickname has joined #commonlisp
random-nickname has quit [Remote host closed the connection]
z4kz has quit [Quit: Client closed]
random-nick has quit [Client Quit]
razetime has joined #commonlisp
siabard has quit [Remote host closed the connection]
<Nilby>
rotateq: sorry, Lisp can make database programming automatically functional, but not automatically fun. For that I recommend always write jokes in your code: https://plaster.tymoon.eu/view/3076#3076
admich1 has quit [Read error: Connection reset by peer]
<rotateq>
Nilby: Don't worry, I try to find the fun in SQL itself and relational algebra to have a good basis.
admich1 has joined #commonlisp
<rotateq>
Good joke. :)
admich1 has quit [Read error: Connection reset by peer]
lisp123 has quit [Remote host closed the connection]
admich1 has joined #commonlisp
cosimone has quit [Remote host closed the connection]
cosimone has joined #commonlisp
kevingal has joined #commonlisp
yauhsien has joined #commonlisp
yewscion has joined #commonlisp
<pjb>
flip214: yes, istm that you need to copy-and-paste the boa. You can always factorize with a function, but most of the boa side effects are usually done in the &aux variables…
<pjb>
flip214: perhaps with a temp aux: (:constructor foo (a b &aux (temp (factorized-boa a b)) (f1 (first temp)) (f2 (second temp))))
<pjb>
flip214: this way factorized-boa could even be generic.
<pjb>
the substructure would have: (:constructor foo (a b c &aux (temp (factorized-boa a b c #|if optional|#)) (f1 (first temp)) (f2 (second temp)) (f3 (second temp))))
<pjb>
flip214: it may be easier to read with (:constructor %make-foo) and separate constructor (generic) functions calling %make-foo or %make-bar).
pve has joined #commonlisp
Bike has joined #commonlisp
<flip214>
pjb: yeah, I've got a (DEFINE-FOO) that takes a function argument (MAKE-FOO resp. MAKE-BAR) and calls that with initargs
Inline has joined #commonlisp
Inline has quit [Remote host closed the connection]
pjb has quit [Ping timeout: 240 seconds]
aartaka has quit [Ping timeout: 272 seconds]
vats has quit [Read error: Connection reset by peer]
aartaka has joined #commonlisp
X-Scale` has joined #commonlisp
X-Scale has quit [Ping timeout: 272 seconds]
X-Scale` is now known as X-Scale
pranavats has left #commonlisp [Error from remote client]
igemnace has quit [Quit: WeeChat 3.5]
zacts has joined #commonlisp
admich1 has quit [Remote host closed the connection]
amk has quit [Remote host closed the connection]
amk has joined #commonlisp
yauhsien has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
yauhsien has quit [Ping timeout: 276 seconds]
kevingal has quit [Ping timeout: 272 seconds]
ick has joined #commonlisp
waleee has joined #commonlisp
yauhsien has joined #commonlisp
zacts is now known as z4kz
z4kz has quit [Quit: Client closed]
z4kz has joined #commonlisp
rotateq has quit [Quit: ERC (IRC client for Emacs 26.3)]
yauhsien has quit [Remote host closed the connection]
jsq has joined #commonlisp
yauhsien has joined #commonlisp
jsq has quit [Client Quit]
yauhsien has quit [Ping timeout: 248 seconds]
phantomics has joined #commonlisp
epolanski has quit [Quit: Connection closed for inactivity]
yauhsien has joined #commonlisp
rotateq has joined #commonlisp
aeth has quit [Ping timeout: 276 seconds]
aeth has joined #commonlisp
joast has joined #commonlisp
frgo has joined #commonlisp
admich has joined #commonlisp
frgo has quit [Ping timeout: 276 seconds]
lisp123 has joined #commonlisp
Cymew has quit [Quit: Konversation terminated!]
Catie has joined #commonlisp
lisp123 has quit [Ping timeout: 276 seconds]
xaotuk has quit [Ping timeout: 240 seconds]
triffid has quit [Remote host closed the connection]
pjb has quit [Ping timeout: 248 seconds]
triffid has joined #commonlisp
ttree has joined #commonlisp
Everything has quit [Remote host closed the connection]
matt` has joined #commonlisp
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<flip214>
I've got a variable; just evaluating (identity foo) [via swank] prints the value. but evaluating (let ((*print-circle* t)) (identity foo)) writes ";; undefined variable: FOO" (and some more) followed by the variable value...
<flip214>
Removing the PRINT-OBJECT method changes the displayed value (now the structure contained gets printed instead of just my abbreviation), but the warning on (*PRINT-CIRCLE* T) stays...
<flip214>
ah sorry, of course I've got a (PRIN1-TO-STRING ...) in the LET, to have *PRINT-CIRCLE* being used
<flip214>
looks like there's a difference between the form being interpreted and compiled...
<flip214>
(defun bar () (prin1-to-string foo)) writes the warning, too
wildlander has joined #commonlisp
<Bike>
what implementation/context is this?
<flip214>
sbcl... seems to believe that a normal variable name (without earmuffs) is a local, always
<flip214>
(setf bar 22) (defun foo () (prin1-to-string bar))
<flip214>
for a short test case
morganw has joined #commonlisp
<Bike>
you shouldn't do a setf like that without first using defvar/defparameter
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Read error: Connection reset by peer]
<Bike>
yeah, ok, i see. the interpreter is simpler so it's not warning you, but you still shouldn't do this
NotThatRPG has joined #commonlisp
<Bike>
it's nothing to do with earmuffs. you can see the same behavior if you do *bar* instead of bar.
<flip214>
well, the symbol values are set with (setf (symbol-value ...)) ... should I declare them special as well?
<Bike>
yes. you can just do `(defvar *variable*)`
<Bike>
this essentially just informs sbcl that the variable should be treated as a special everywhere. without that, it guesses that they're special, but it doesn't want to rely on guessing your intentions so it warns you.
<Bike>
if you are doing something a little more exotic that would preclude having the symbol literally present in your code, you can use cl:proclaim to do it more programmatically.
ick has quit [Ping timeout: 246 seconds]
vats has joined #commonlisp
<Nilby>
print-object methods are tricky. they can make your debugger and repl not work
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<sveit>
hi. is there a way to access shared slots without an instance?
<jackdaniel>
class-allocated slots - no, there is no way
NotThatRPG has joined #commonlisp
<sveit>
jackdaniel: thanks. just double-checking the obvious, are class-allocated slots the same as "shared slots" (I have only seen them referred to as the latter in the standard)?
<sveit>
и
<jackdaniel>
yes
<jackdaniel>
if the slot allocation is :class then it is a shared slot
frgo has joined #commonlisp
frgo has quit [Remote host closed the connection]
frgo has joined #commonlisp
<sveit>
seems a strange choice to not let one modify the shared slot without an instance...
pjb has joined #commonlisp
<jackdaniel>
well, the slot is shared among instances, not owned by the class
<jackdaniel>
you could create a class that subclasses a standard-class and has a slot of its own
<jackdaniel>
then you could manage this slot without caring about instances
<dlowe>
you could also just use defvar
<jackdaniel>
(a metaclass, or a class metaobject if we use amop terminoogy)
<dlowe>
classes aren't namespaces in common lisp. There's no benefit of sticking it into a class just because
Guest74 has quit [Ping timeout: 272 seconds]
<pjb>
well, slot names are in a class namespace! (class and subclasses)
euandreh has quit [Quit: WeeChat 3.5]
<pjb>
So using :allocation :class is a good way to define a global variable in the class scope.
karlosz has joined #commonlisp
orestarod has joined #commonlisp
<flip214>
Bike: well, the symbol name is given by the user, so cl:proclaim it is.
<flip214>
sveit: after closer-mop:ensure-finalized, you can use closer-mop:class-prototype to get an instance you can use for shared slots
admich has quit [Remote host closed the connection]
admich has joined #commonlisp
<dlowe>
Still not clever enough to see the value in doing this.
admich has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)]
Bike has quit [Quit: Connection closed]
Guest74 has joined #commonlisp
<flip214>
the value of shared slots?
euandreh has joined #commonlisp
<jackdaniel>
it is 42
lisp123 has joined #commonlisp
Guest74 is now known as jmc
<flip214>
if the sb-kernel:get-lisp-obj-address of two conses is different, can they be EQ?
jmc has left #commonlisp [#commonlisp]
<jackdaniel>
sbcl likes to moves objects
<jackdaniel>
so between reads the address could have changed
<jackdaniel>
s/moves/move/
<flip214>
well, I've got a HASH-TABLE EQ where I store list => numeric ID; after some processing I try to find stale entries in the hash and want to remove them
<flip214>
but I get two keys with different addresses, but SBCL says they're EQ -- reproducible
<jackdaniel>
can you tell a difference without using internal symbols?
<jackdaniel>
i.e try modifying car of one of these conses and see whether car of the other one is also modified
karlosz has quit [Quit: karlosz]
lisp123 has quit [Ping timeout: 246 seconds]
<flip214>
for testing, yeah...
<jackdaniel>
would there be any interest in running ecl in a browser (as a wasm module)?
guest74 has joined #commonlisp
pranavats has joined #commonlisp
Bike has joined #commonlisp
aartaka has quit [Ping timeout: 256 seconds]
aartaka has joined #commonlisp
yauhsien has quit [Remote host closed the connection]
<scymtym>
is that the secret benefit of the mcclim sdl backend?
<jackdaniel>
I didn't think about it, but sdl works in there, so it could be :)
jsq has joined #commonlisp
yauhsien has joined #commonlisp
jsq has quit [Client Quit]
jeosol has joined #commonlisp
yauhsien has quit [Ping timeout: 272 seconds]
kpoeck has joined #commonlisp
slowButPresent has joined #commonlisp
guest74 has quit [Quit: Connection closed]
treflip has quit [Quit: goodnight]
random-nick has quit [Remote host closed the connection]
random-nick has joined #commonlisp
aeth has quit [Ping timeout: 260 seconds]
aeth has joined #commonlisp
speskk has joined #commonlisp
dlowe has quit [Remote host closed the connection]
dlowe has joined #commonlisp
xaotuk has joined #commonlisp
Oddity has joined #commonlisp
shka has quit [Quit: Konversation terminated!]
shka has joined #commonlisp
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 260 seconds]
cage has quit [Quit: rcirc on GNU Emacs 27.1]
kpoeck has quit [Quit: Client closed]
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
dra has joined #commonlisp
morganw has quit [Remote host closed the connection]
attila_lendvai has quit [Ping timeout: 256 seconds]
scymtym has quit [Ping timeout: 240 seconds]
Brucio-61 has quit [Ping timeout: 250 seconds]
jmdaemon has joined #commonlisp
shka has quit [Ping timeout: 272 seconds]
abrantesasf has joined #commonlisp
Brucio-61 has joined #commonlisp
scymtym has joined #commonlisp
<ehammarstrom>
I am trying to figure out how to generate a let binding (let ((a x) (b x) c (x)) ...) using a macro, how do I evaluate the mapcar such that I get the list of bindings that I want? https://plaster.tymoon.eu/view/3078#3078
<pjb>
(let ((varnames '(a b c))) `(let ,(mapcar (lambda (varname) `(,varname ',(gensym))) varnames) (list ,@varnames))) #| --> (let ((a '#:g3571) (b '#:g3572) (c '#:g3573)) (list a b c)) |#
<pjb>
ehammarstrom: but in general, we use the gensyms as varnames ;-)
Dynom has quit [Quit: WeeChat 3.5]
<pjb>
oh, I didn't realize you're implementing with-gensyms; it's already in alexandria.
<pjb>
(defmacro with-gensyms ((&rest varnames) &body body) `(let ,(mapcar (lambda (varname) `(,varname ',(gensym))) varnames) ,@body)) (with-gensyms (a b c) (list a b c)) #| --> (#:g3600 #:g3601 #:g3602) |#
<rotateq>
pjb: But it's good when thinking about how it works. :) What this does too is (let ((a (gensym "A")) (b (gensym "B")) (c (gensym "C"))) ...) and I like that, so when looking at macroexpands it's way easier to track what is what.
<ehammarstrom>
I'm reading through let-over-lambda and thought I could give it a shot before it's revealed later on
<ehammarstrom>
Why do we `(,s ',(gensym)) instead of `(,s (gensym))? Both seems to work
<rotateq>
ehammarstrom: Cool :) Hope the book doesn't give you a too tough time.
<rotateq>
ehammarstrom: The former generates the gensym at compile time.
<ehammarstrom>
rotateq: Ah!
<rotateq>
And as we're already at generating code we do as much at that stage as possible.
<pjb>
(defmacro with-gensyms ((&rest varnames) &body body) `(let ,(mapcar (lambda (varname) `(,varname ',(gensym (string varname)))) varnames) ,@body)) (with-gensyms (a b c) (list a b c)) #| --> (#:a3620 #:b3621 #:c3622) |#
<pjb>
ehammarstrom: without the quote, it will try to evaluate the generated symbols, but since they're not bound, this will make unbound variable reference errors.
<rotateq>
So another good thing, get errors signal at compile time.
<ehammarstrom>
I see, thanks!
<rotateq>
ehammarstrom: Or to put in an assertion that all elements in VARNAMES are symbols.
<_death>
actually with-gensyms usually generates code that evaluates gensym each time.. this variant reuses a symbol, and its user better be aware of it
<ehammarstrom>
_death: I'm not lisper enough to understand what you're doing here but are you saying that generating (a (gensym)) is preferred over (a '(gensym))?
<rotateq>
Oh and I now see the one from alexandria doesn't actually generate the gensymy at compile time.
<ehammarstrom>
_death: '(gensym) over ',(gensym) that is
hineios has joined #commonlisp
<ehammarstrom>
(gensym) over ',(gensym) ..
<rotateq>
ehammarstrom: So now you have your own 'over' situation. :) like in the book's title
<_death>
ehammarstrom: in typical use, gensym is called so that you get a symbol that's not used anywhere else.. a macro writer, for example would use (let ((var (gensym))) `(... ,var ...)) .. this is common, so a with-gensyms operator can be used to make things shorter, and to add niceties like more readable symbol names (based on the names passed to it).. typically you wouldn't expect the symbol to be reused across multiple macroexpansions
<_death>
so if with-gensyms expands to a form that calls gensym each time, that makes sense, and is similar to the LET form I've shown.. but if you have it expand to (let ((var '#:some-symbol)) ...) it's may screw you over down the road if you didn't expect it to do so (and I guess most users of with-gensyms would not expect it to)
vats has quit [Ping timeout: 256 seconds]
tyson2 has quit [Remote host closed the connection]
aeth has quit [Ping timeout: 256 seconds]
aeth has joined #commonlisp
orestarod has quit [Ping timeout: 250 seconds]
yewscion has quit [Ping timeout: 272 seconds]
Algernon69 has quit [Ping timeout: 248 seconds]
xaotuk has quit [Read error: Connection reset by peer]
gpiero has quit [Read error: Connection reset by peer]
gpiero has joined #commonlisp
Posterdati has quit [Ping timeout: 256 seconds]
tyson2 has joined #commonlisp
dra has quit [Remote host closed the connection]
Posterdati has joined #commonlisp
poselyqualityles has quit [Ping timeout: 256 seconds]
matt` has quit [Remote host closed the connection]
X-Scale` has joined #commonlisp
X-Scale has quit [Ping timeout: 272 seconds]
X-Scale` is now known as X-Scale
ec has quit [Quit: ec]
lisp123 has joined #commonlisp
marethyu has joined #commonlisp
X-Scale` has joined #commonlisp
makomo has quit [Ping timeout: 272 seconds]
lisp123 has quit [Ping timeout: 240 seconds]
X-Scale has quit [Ping timeout: 276 seconds]
X-Scale` is now known as X-Scale
marethyu has quit [Quit: Leaving]
speskk has quit [Quit: Bye.]
pranavats has left #commonlisp [Error from remote client]