awlygj has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
awlygj has joined #commonlisp
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Everything has quit [Quit: leaving]
pranav has quit [Remote host closed the connection]
awlygj has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
awlygj has joined #commonlisp
pranav has joined #commonlisp
olivial has quit [Ping timeout: 248 seconds]
olivial has joined #commonlisp
mzan has quit [Read error: Connection reset by peer]
notzmv has joined #commonlisp
awlygj has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
mzan has joined #commonlisp
anticomputer_ has quit [Ping timeout: 260 seconds]
awlygj has joined #commonlisp
anticomputer has joined #commonlisp
alip has quit [Ping timeout: 252 seconds]
ElKowar has quit [Ping timeout: 244 seconds]
triffid has quit [Ping timeout: 260 seconds]
chiselfuse has quit [Ping timeout: 260 seconds]
chiselfuse has joined #commonlisp
triffid has joined #commonlisp
alip has joined #commonlisp
shawnw has quit [Ping timeout: 265 seconds]
ElKowar has joined #commonlisp
awlygj has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
awlygj has joined #commonlisp
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Akbar-Birbal has joined #commonlisp
Pixel_Outlaw has quit [Quit: Leaving]
pranav has quit [Remote host closed the connection]
rkazak has quit [Ping timeout: 265 seconds]
pranav has joined #commonlisp
szkl has quit [Quit: Connection closed for inactivity]
contrapunctus has left #commonlisp [#commonlisp]
rkazak has joined #commonlisp
shawnw has joined #commonlisp
rkazak has quit [Ping timeout: 252 seconds]
rkazak2 has joined #commonlisp
rkazak2 has quit [Ping timeout: 260 seconds]
emaczen has joined #commonlisp
rkazak2 has joined #commonlisp
wacki has joined #commonlisp
mulk has quit [Ping timeout: 255 seconds]
rkazak2 has quit [Ping timeout: 260 seconds]
mulk has joined #commonlisp
k_hachig_ has quit [Ping timeout: 248 seconds]
mishoo has joined #commonlisp
jadzi has joined #commonlisp
emaczen has quit [Remote host closed the connection]
k_hachig_ has joined #commonlisp
jadzi has quit [Ping timeout: 248 seconds]
wacki has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
k_hachig_ has quit [Ping timeout: 265 seconds]
rkazak2 has joined #commonlisp
rkazak2 has quit [Ping timeout: 260 seconds]
treflip has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 260 seconds]
Lord_of_Life_ is now known as Lord_of_Life
rkazak has joined #commonlisp
amb007 has quit [Ping timeout: 252 seconds]
amb007 has joined #commonlisp
pve has joined #commonlisp
shawnw has quit [Ping timeout: 252 seconds]
contrapunctus has joined #commonlisp
mishoo has quit [Ping timeout: 252 seconds]
mathrick has quit [Ping timeout: 260 seconds]
jadzi has joined #commonlisp
rkazak has quit [Ping timeout: 248 seconds]
Ruby has quit [Ping timeout: 260 seconds]
Ruby has joined #commonlisp
amb007 has quit [Ping timeout: 260 seconds]
King_julian has joined #commonlisp
amb007 has joined #commonlisp
mathrick has joined #commonlisp
disruptek has quit [Quit: bye]
disruptek has joined #commonlisp
rkazak2 has joined #commonlisp
King_julian has quit [Read error: Connection reset by peer]
k_hachig_ has joined #commonlisp
k_hachig_ has quit [Ping timeout: 248 seconds]
rkazak2 has quit [Ping timeout: 260 seconds]
mgl_ has joined #commonlisp
rkazak2 has joined #commonlisp
GalaxyNova has joined #commonlisp
Cymew has joined #commonlisp
rkazak2 has quit [Ping timeout: 252 seconds]
varjag has joined #commonlisp
bendersteed has joined #commonlisp
theruran has quit [Quit: Connection closed for inactivity]
mishoo has joined #commonlisp
rkazak has joined #commonlisp
GalaxyNova has quit [Ping timeout: 252 seconds]
pkal has quit [Read error: Connection reset by peer]
pkal has joined #commonlisp
dino_tutter has joined #commonlisp
rkazak has quit [Ping timeout: 246 seconds]
k_hachig_ has joined #commonlisp
k_hachig_ has quit [Ping timeout: 248 seconds]
gorignak has quit [Ping timeout: 260 seconds]
gorignak has joined #commonlisp
rkazak has joined #commonlisp
rkazak has quit [Ping timeout: 260 seconds]
Akbar-Birbal has left #commonlisp [#commonlisp]
Akbar-Birbal has joined #commonlisp
rkazak has joined #commonlisp
rkazak has quit [Ping timeout: 252 seconds]
rkazak2 has joined #commonlisp
k_hachig_ has joined #commonlisp
rkazak2 has quit [Ping timeout: 252 seconds]
k_hachig_ has quit [Ping timeout: 248 seconds]
zwr has quit [Read error: Connection reset by peer]
rkazak has joined #commonlisp
pillton has quit [Remote host closed the connection]
zwr has joined #commonlisp
treflip has quit [Remote host closed the connection]
treflip has joined #commonlisp
Gleefre has quit [Ping timeout: 256 seconds]
pranav has quit [Remote host closed the connection]
rkazak has quit [Ping timeout: 265 seconds]
treflip has quit [Ping timeout: 272 seconds]
random-nick has joined #commonlisp
treflip has joined #commonlisp
mange has quit [Quit: Zzz...]
k_hachig_ has joined #commonlisp
mwnaylor has quit [Ping timeout: 260 seconds]
k_hachig_ has quit [Ping timeout: 265 seconds]
rkazak2 has joined #commonlisp
rkazak2 has quit [Ping timeout: 252 seconds]
jonatack has joined #commonlisp
pranav has joined #commonlisp
rkazak2 has joined #commonlisp
uhuh has joined #commonlisp
uhuh has quit [Client Quit]
rkazak2 has quit [Ping timeout: 276 seconds]
apac has joined #commonlisp
k_hachig_ has joined #commonlisp
k_hachig_ has quit [Ping timeout: 248 seconds]
notzmv has quit [Ping timeout: 248 seconds]
rkazak has joined #commonlisp
AetherWind has joined #commonlisp
treflip has quit [Ping timeout: 246 seconds]
rkazak has quit [Ping timeout: 252 seconds]
Jach has joined #commonlisp
Equill has joined #commonlisp
livoreno has joined #commonlisp
livoreno has quit [Changing host]
livoreno has joined #commonlisp
chomwitt has joined #commonlisp
rkazak2 has joined #commonlisp
rkazak2 has quit [Ping timeout: 248 seconds]
uhuh has joined #commonlisp
treflip has joined #commonlisp
<uhuh>
Is it feasible to subclass the function class to create a function version with additional features? I can create a subclass successfully, but when I try to make an instance of it, I get an error saying that there's a protocol violation.
<jackdaniel>
you need to subclass c2mop:funcallable-standard-class
<jackdaniel>
in initialize-instance call c2mop:set-funcallable-instance-function and assign an appropriate "low-level" function
<jackdaniel>
s/and assign/to assign/
<beach>
uhuh: FUNCTION is a system class, so you can't subclass it. But, as jackdaniel is pointing out, you can use the MOP class FUNCALLABLE-STANDARD-CLASS instead.
dnhester26 has joined #commonlisp
<dnhester26>
NotThatRPG: regarding your comment about loop yesterday: what's the difference between using the if-then-else syntax or just using regular common lisp forms like (if (predicate) (then) (else))? the indentation? What's the problem of not using it?
<beach>
dnhester26: You can safely ignore the remarks by NotThatRPG, but it's OK if you are curious about the difference of course.
<uhuh>
This worked, thanks jackdaniel and beach !
<dnhester26>
jackdaniel: can you please explain your comment about the loop variable being assigned and not bound?
<dnhester26>
beach: thanks, I was a bit curious since he was programming in the context of more people and since I'm only by myself I don't have access to code reviews and peer critique which can be very helpful to learn and improve
<jackdaniel>
(loop for x in '(1 2 3)
<jackdaniel>
somewhat superficial example, but: (mapcar #'funcall
<jackdaniel>
collect (lambda () (print `(x is ,x)))))
<dnhester26>
,(mapcar #'funcall (loop for x in '(1 2 3) collect (lambda () (print `(x is ,x)))))
<ixelp>
↩ (X IS 3) ↩ (X IS 3) ↩ (X IS 3) => ((X IS 3) (X IS 3) (X IS 3))
<jackdaniel>
if you collect the lambda that captures x from (dolist (x '(1 2 3)) ...), then you'll have (x is 1) (x is 2) and (x is 3), because you have fresh bindings for each iteration
<jackdaniel>
the fact that loop reuses the same variable is not very surprising on its own, but it can bite you gravely, especially when you collect values in macros for further expansion
<jackdaniel>
so the way to do that, with loop, is something like collect (let ((x x)) (lambda () ...))
<dnhester26>
thanks so much for the explanation
<jackdaniel>
sure
<jdz>
dnhester26: About the if-then-else: if you use LOOP's, you can also use the value accumulation constructs, etc.
<jackdaniel>
n.b collecting macros decouples from loop are very useful
rkazak has joined #commonlisp
AetherWind has quit [Quit: leaving]
<jdz>
,(loop for x in '(1 2 3 4) if (evenp x) collect (* x 2) else collect (- x 1))
<ixelp>
=> (0 4 2 8)
amb007 has quit [Read error: Connection reset by peer]
<jdz>
This particular example is not very illustrative since one could use COLLECT (IF ...
notzmv has joined #commonlisp
<dnhester26>
jdz: thanks for pointing that out. so it was more of a critique on colleagues not using the given constructs that make collecting convenient more than loop being bad, it's just that it's hard to learn the syntax
apac has quit [Ping timeout: 248 seconds]
<dnhester26>
jackdaniel: i have no idea what you said "collecting macros decouples from loop are very useful"
<jackdaniel>
loop is awful, although it is useful at times. for anything non trivial I'm usually writing my own macro that is based on DO or MAP variant
<jackdaniel>
well, CMU in its extensions defines a macro collecting that may be used like that: (collecting (acc) (acc 1) (dotimes (v 3) (acc v)) (print (acc)))
<beach>
dnhester26: I think jackdaniel meant "decoupled".
<dnhester26>
ah ok, thanks
<jackdaniel>
yes, decoupled
<dnhester26>
ahh `collecting` is a type of macro, so those types of macros that decouple from loop are very useful
<dnhester26>
beach: thanks
<jdz>
Iterate is better in this regard, but then one has to use iterate.
<jackdaniel>
I think that hash access syntax in loop is the least memorizable part of the standard :)
<jdz>
And awkward to boot.
<jackdaniel>
du-hash-mich * damn
<jdz>
I still read it with Rammstein playing in my head :)
<dnhester26>
hahaha me too
<dnhester26>
thanks for the discussion
<beach>
dnhester26: For what it's worth, I think LOOP is fine. And the SLIME-INDENTATION contribution is quite good actually.
<dnhester26>
we basically just have to keep in mind to not use the variable in any place where it is bound because the actual value will change on the next iteration. is that a good understanding?
<dnhester26>
s/to not/not to
<beach>
Yes, but the fix is simple as jackdaniel pointed out.
<beach>
,(mapcar #'funcall (loop for x in '(1 2 3) collect (let ((x x)) (lambda () (print `(x is ,x))))))
<ixelp>
↩ (X IS 1) ↩ (X IS 2) ↩ (X IS 3) => ((X IS 1) (X IS 2) (X IS 3))
amb007 has joined #commonlisp
<dnhester26>
thanks, yeah, so whenever we want to capture something, use a let. what about when pushing to a list defined outside the loop? it pushes the value, not the pointer to the loop's variable right? `(let ((my-list '())) (loop for i from 0 to 5 do (push i my-list)))
<dnhester26>
,(let ((my-list '())) (loop for i from 0 to 5 do (push i my-list)) my-list)
<ixelp>
=> (5 4 3 2 1 0)
<dnhester26>
is it because of how push works that it doesn't push the pointer but the actual value? why isn't it (5 5 5 5 5 5)?
<beach>
dnhester26: You are confused.
<dnhester26>
yes I am
<beach>
dnhester26: All objects are treated the same in Common Lisp, semantically speaking.
<dnhester26>
is it because in the push we are pushing the x's pointers data, whereas in the lambda, we are binding the reference to x instead of it's data, correct?
k_hachig_ has joined #commonlisp
<beach>
What phenomenon are you trying to explain with "because ..."?
rkazak has quit [Ping timeout: 265 seconds]
<jackdaniel>
dnhester26: lambda captures variable, while what you push is a value
<dnhester26>
why here ,(mapcar #'funcall (loop for x in '(1 2 3) collect (lambda () (print `(x is ,x))))) the result is the last value of x in the iteration
<ixelp>
(mapcar #'funcall (loop for x in '(1 2 3) collect (lambda () (print `(x is ,x))))) ↩ (X IS 3) ↩ (X IS 3) ↩ (X IS 3) => ((X IS 3) (X IS 3) (X IS 3))
gooba has quit [Remote host closed the connection]
<dnhester26>
and here it keeps the value at that step in the iteration ,(let ((my-list '())) (loop for i from 0 to 5 do (push i my-list)) my-list)
<ixelp>
(let ((my-list '())) (loop for i from 0 to 5 do (push i my-list)) my-list) => (5 4 3 2 1 0)
<dnhester26>
jackdaniel: thanks, yeah, that's what I was trying to confirm, so I think i got it
gooba has joined #commonlisp
<dnhester26>
thanks
<beach>
dnhester26: It is because LOOP introduces a single variable for X and then assigns to it in each iteration.
<jdz>
Maybe "closure captures a binding".
gooba has quit [Remote host closed the connection]
<jackdaniel>
lambda creates a closure over a binding \o/
<dnhester26>
so inside of loop we have to be careful with any binding of a loop variable
<beach>
Why?
<beach>
dnhester26: You need to know the semantics of every standard operator you use, and LOOP is no exception.
gooba has joined #commonlisp
<jackdaniel>
and since semantics of loop are tricky.. you need to be careful with it (because you know now that they are tricky:)
<beach>
dnhester26: The example of DOLIST doesn't mean that DOLIST is right and LOOP is wrong. They have different semantics. It is not always the case that you want a new binding in each iteration.
gooba has quit [Remote host closed the connection]
NotThatRPG has joined #commonlisp
gooba has joined #commonlisp
chomwitt has quit [Ping timeout: 255 seconds]
<jackdaniel>
jdz: technically speaking dotimes behavior wrt bindings is implementation-dependent
<jackdaniel>
and that's the case with dolist as well
<jackdaniel>
so perhaps the fact that loop has clear semantics here makes it actually better
<jackdaniel>
dlowe: ^ (I've made an incorrect statement the other day)
<jdz>
dnhester26: also, a better example of LOOP above is:
<jdz>
,(loop for x in '(1 2 3 4 5) if (oddp x) collect x)
<ixelp>
=> (1 3 5)
<dnhester26>
jdz: thanks
Equill has quit [Ping timeout: 265 seconds]
zxcvz has joined #commonlisp
shawnw has joined #commonlisp
rkazak has joined #commonlisp
skempf has quit [Quit: .]
skempf has joined #commonlisp
uhuh has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.4)]
<beach>
dnhester26: I re-read some of your mention of "pointers". A better model is what jdz hinted, that when you do (LET ((X X)) ...) in each iteration, LET creates a new "binding" and that binding is captured by the LAMBDA form. Since there are no assignments to the variable in that binding, it stays the same forever. And it is initialized to the value of the iteration variable in each iteration.
<beach>
dnhester26: So the iteration variable X is not the same as the variable X introduced by the LET.
<beach>
Maybe it would have been clearer to do (LET ((Y X)) (LAMBDA () ... Y ...)) instead.
<beach>
... a procedure known as "alpha renaming".
<dnhester26>
thanks, I think I got it
<beach>
Great!
<dnhester26>
:D
brokkoli_origin has quit [Ping timeout: 252 seconds]
chomwitt has joined #commonlisp
rkazak has quit [Ping timeout: 276 seconds]
rgherdt has joined #commonlisp
brokkoli_origin has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 246 seconds]
Equill has joined #commonlisp
amb007 has joined #commonlisp
k_hachig_ has quit [Ping timeout: 260 seconds]
k_hachig_ has joined #commonlisp
rkazak has joined #commonlisp
varjag has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3)]
Cymew has quit [Quit: Konversation terminated!]
Cymew has joined #commonlisp
Cymew has quit [Client Quit]
Cymew has joined #commonlisp
k_hachig_ has quit [Ping timeout: 255 seconds]
mgl_ has quit [Ping timeout: 265 seconds]
mishoo has quit [Remote host closed the connection]
chiselfuse has quit [Ping timeout: 260 seconds]
Cymew has quit [Ping timeout: 260 seconds]
chiselfuse has joined #commonlisp
jonatack has quit [Read error: Connection reset by peer]
mishoo has joined #commonlisp
mgl_ has joined #commonlisp
k_hachig_ has joined #commonlisp
k_hachig_ has quit [Ping timeout: 252 seconds]
rkazak has quit [Ping timeout: 272 seconds]
apac has joined #commonlisp
mgl_ has quit [Ping timeout: 252 seconds]
Guest25 has joined #commonlisp
livoreno has quit [Quit: Connection closed for inactivity]
k_hachig_ has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
k_hachig_ has quit [Ping timeout: 265 seconds]
Equill has quit [Ping timeout: 246 seconds]
k_hachig_ has joined #commonlisp
rkazak2 has joined #commonlisp
dnhester26 has joined #commonlisp
k_hachig_ has quit [Ping timeout: 245 seconds]
rkazak2 has quit [Ping timeout: 245 seconds]
rkazak has joined #commonlisp
yitzi has joined #commonlisp
k_hachig_ has joined #commonlisp
attila_lendvai has joined #commonlisp
theruran has joined #commonlisp
bitspook has quit [Ping timeout: 252 seconds]
k_hachig_ has quit [Ping timeout: 252 seconds]
bitspook has joined #commonlisp
zxcvz has quit [Quit: zxcvz]
k_hachig_ has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
alcor has joined #commonlisp
rkazak has quit [Ping timeout: 260 seconds]
scymtym has quit [Ping timeout: 252 seconds]
scymtym has joined #commonlisp
attila_lendvai has quit [Ping timeout: 265 seconds]
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
k_hachig_ has quit [Ping timeout: 252 seconds]
zxcvz has joined #commonlisp
Akbar-Birbal has left #commonlisp [#commonlisp]
JuanDaugherty has quit [Quit: JuanDaugherty]
Akbar-Birbal has joined #commonlisp
k_hachig_ has joined #commonlisp
rkazak2 has quit [Ping timeout: 248 seconds]
k_hachig_ has quit [Ping timeout: 255 seconds]
k_hachig_ has joined #commonlisp
jadzi has quit [Ping timeout: 246 seconds]
k_hachig_ has quit [Ping timeout: 246 seconds]
JuanDaugherty has joined #commonlisp
rkazak2 has joined #commonlisp
JuanDaugherty has quit [Remote host closed the connection]
zxcvz has quit [Quit: zxcvz]
k_hachig_ has joined #commonlisp
dnhester26 has quit []
k_hachig_ has quit [Ping timeout: 252 seconds]
k_hachig_ has joined #commonlisp
scymtym has quit [Remote host closed the connection]
scymtym has joined #commonlisp
k_hachig_ has quit [Ping timeout: 252 seconds]
akoana has joined #commonlisp
rkazak2 has quit [Ping timeout: 260 seconds]
jonatack has joined #commonlisp
k_hachig_ has joined #commonlisp
k_hachig_ has quit [Ping timeout: 252 seconds]
Akbar-Birbal has left #commonlisp [#commonlisp]
treflip has quit [Ping timeout: 252 seconds]
Equill has joined #commonlisp
k_hachig_ has joined #commonlisp
k_hachig_ has quit [Ping timeout: 245 seconds]
rkazak has joined #commonlisp
GalaxyNova has joined #commonlisp
jonatack has quit [Read error: Connection reset by peer]
zxcvz has joined #commonlisp
akoana has quit [Quit: leaving]
k_hachig_ has joined #commonlisp
JuanDaugherty has joined #commonlisp
k_hachig_ has quit [Ping timeout: 246 seconds]
rkazak has quit [Ping timeout: 260 seconds]
k_hachig_ has joined #commonlisp
eddof13 has joined #commonlisp
eddof13 has quit [Client Quit]
GalaxyNova has quit [Ping timeout: 260 seconds]
k_hachig_ has quit [Ping timeout: 276 seconds]
notzmv has quit [Ping timeout: 265 seconds]
zwr has quit [Ping timeout: 272 seconds]
demask has joined #commonlisp
<demask>
hi there o/
<demask>
guys need your help trying to bind emacs slime sbcl and quicklisp
<demask>
why when I try to create user hashtable and fill it sbcl constantly says undefined function puthash
demask has left #commonlisp [ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.4)]
varjagg has joined #commonlisp
mishoo has quit [Ping timeout: 260 seconds]
eddof13 has joined #commonlisp
pve has quit [Quit: leaving]
zxcvz has quit [Quit: zxcvz]
JuanDaugherty has quit [Quit: JuanDaugherty]
shka has quit [Quit: Konversation terminated!]
cage has quit [Quit: rcirc on GNU Emacs 29.4]
rkazak has joined #commonlisp
bendersteed has quit [Quit: bendersteed]
kevingal has joined #commonlisp
k_hachig_ has joined #commonlisp
mwnaylor has joined #commonlisp
k_hachig_ has quit [Ping timeout: 248 seconds]
eddof13 has quit [Quit: eddof13]
k_hachig_ has joined #commonlisp
apac has joined #commonlisp
k_hachig_ has quit [Ping timeout: 248 seconds]
notzmv has joined #commonlisp
k_hachig_ has joined #commonlisp
rkazak has quit [Ping timeout: 252 seconds]
istewart has joined #commonlisp
k_hachig_ has quit [Ping timeout: 260 seconds]
dajole has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
zwr has joined #commonlisp
anticomputer has quit [Remote host closed the connection]
<kagevf>
delyan_: I think you have to use (setf (gethash key table) new-value)
anticomputer has joined #commonlisp
<kagevf>
oops sorry meant demask ... but they left
rkazak2 has joined #commonlisp
mange has joined #commonlisp
rkazak2 has quit [Ping timeout: 265 seconds]
alcor has quit [Remote host closed the connection]
rkazak has joined #commonlisp
wacki has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rkazak has quit [Ping timeout: 260 seconds]
apac has quit [Quit: Konversation terminated!]
ryanbw has quit [Ping timeout: 255 seconds]
varjagg has quit [Ping timeout: 245 seconds]
ryanbw has joined #commonlisp
rkazak2 has joined #commonlisp
Everything has joined #commonlisp
<NotThatRPG>
demask: you want setf-gethash
<NotThatRPG>
Question: anyone know if there's code out there that wraps an SBCL FDSTREAM so that it can be accessed through the gray streams interface?