<edwlu543>
I just noticed that 'delete' doesn't delete the first element from the sequence. E.g. (setf l '(1 2 3 4)) (delete 1 l). l doesn't change, is this intended?
<_death>
(i) you should not pass a literal to DELETE (ii) you should make use of DELETE's return value
<_death>
(a literal for the sequence argument)
<_death>
so, (setf l (list 1 2 3 4)) (setf l (delete 1 l))
<edwlu543>
Yes, however if 2 is passed to delete, the sequence is modified which is a bit strange
<edwlu543>
I was thinking that remove was meant to be used with its return value, and delete could be used to mutate the sequence directly
<_death>
both are meant to be used with their return values.. DELETE is a destructive operator, which means it MAY modify the sequence. since lists are represented as linked cons cells, consider what DELETE would have to do to remove 1 from that list such that you end up with the same head of the list (i.e. the first cons cell)
King_julian has quit [Read error: Connection reset by peer]
<|3b|>
or what it would have to do to turn that cons cell into NIL
<edwlu543>
Yeah, that makes sense
treflip` has quit [Remote host closed the connection]
<|3b|>
(and remember that DELETE is a function, so it only sees the value, and has no way to affect any bindings that might have been storing that value.)
random-nick has joined #commonlisp
<_death>
you can of course define a modify macro to sugar it up (or use one, see alexandria:deletef)
King_julian has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
rbcarleton has joined #commonlisp
surabax has joined #commonlisp
surabax has quit [Remote host closed the connection]
donlcn has joined #commonlisp
uhuh has joined #commonlisp
uhuh has quit [Changing host]
uhuh has joined #commonlisp
iNomad has joined #commonlisp
edwlu543 has quit [Remote host closed the connection]
chomwitt has quit [Ping timeout: 252 seconds]
uhuh has quit [Ping timeout: 265 seconds]
chomwitt has joined #commonlisp
treflip has joined #commonlisp
Oddity has quit [Ping timeout: 252 seconds]
treflip` has joined #commonlisp
treflip has quit [Ping timeout: 252 seconds]
yazz has joined #commonlisp
yazz has quit [Ping timeout: 245 seconds]
treflip` has quit [Ping timeout: 260 seconds]
yazz has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
stanrifkin has joined #commonlisp
mgl has quit []
Guest47 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Gleefre has joined #commonlisp
Guest47 has joined #commonlisp
uhuh has joined #commonlisp
uhuh has quit [Changing host]
uhuh has joined #commonlisp
mange has quit [Quit: Zzz...]
samebchase has joined #commonlisp
chomwitt has quit [Ping timeout: 272 seconds]
danza has quit [Read error: Connection reset by peer]
danza has joined #commonlisp
rgherdt` has joined #commonlisp
rendar has joined #commonlisp
rendar has quit [Changing host]
rendar has joined #commonlisp
chomwitt has joined #commonlisp
stanrifkin has quit [Quit: Leaving]
thuna` has joined #commonlisp
kevingal has joined #commonlisp
apac has joined #commonlisp
rendar has quit [Ping timeout: 268 seconds]
apac has quit [Read error: Connection reset by peer]
Gleefre has quit [Remote host closed the connection]
shawnw_ has joined #commonlisp
shawnw has quit [Read error: Connection reset by peer]
apac has joined #commonlisp
unlucy has quit [Ping timeout: 252 seconds]
unlucy has joined #commonlisp
Alfr has quit [Read error: Connection reset by peer]
Alfr has joined #commonlisp
chomwitt has quit [Ping timeout: 252 seconds]
unlucy has quit [Max SendQ exceeded]
mister_m has quit [Ping timeout: 272 seconds]
gaze__ has quit [Ping timeout: 252 seconds]
griffinmb____ has quit [Ping timeout: 268 seconds]
nxtr has quit [Ping timeout: 252 seconds]
ello- has joined #commonlisp
fourier has quit [Ping timeout: 252 seconds]
squishy_bloob has quit [Ping timeout: 272 seconds]
Catie has quit [Ping timeout: 248 seconds]
squishy_bloob has joined #commonlisp
ejohnson has quit [Ping timeout: 252 seconds]
mister_m has joined #commonlisp
jrm has quit [Ping timeout: 272 seconds]
ello has quit [Ping timeout: 248 seconds]
mathrick has quit [Ping timeout: 268 seconds]
Catie has joined #commonlisp
yacin has quit [Ping timeout: 248 seconds]
Fade has quit [Ping timeout: 272 seconds]
nani has quit [Ping timeout: 272 seconds]
griffinmb____ has joined #commonlisp
ejohnson has joined #commonlisp
unlucy has joined #commonlisp
jrm has joined #commonlisp
drmeister has quit [Ping timeout: 272 seconds]
Fade has joined #commonlisp
latchflip has quit [Remote host closed the connection]
alfiee has quit [Ping timeout: 272 seconds]
White_Flame has quit [Ping timeout: 276 seconds]
latchflip has joined #commonlisp
pabs3 has quit [Ping timeout: 272 seconds]
zephyr has quit [Ping timeout: 276 seconds]
White_Flame has joined #commonlisp
decweb has quit [Remote host closed the connection]
decweb has joined #commonlisp
splittist has quit [Ping timeout: 272 seconds]
mister_m has quit [Ping timeout: 252 seconds]
notzmv has quit [Ping timeout: 252 seconds]
gaze__ has joined #commonlisp
nani has joined #commonlisp
teddydd has quit [Ping timeout: 248 seconds]
bigbookofbug has quit [Ping timeout: 276 seconds]
grawlinson has quit [Ping timeout: 248 seconds]
dbotton has quit [Ping timeout: 272 seconds]
grawlinson has joined #commonlisp
leeb_ has quit [Ping timeout: 276 seconds]
|3b| has quit [Ping timeout: 272 seconds]
teddydd has joined #commonlisp
kst has quit [Ping timeout: 252 seconds]
stylewarning has quit [Ping timeout: 272 seconds]
krjst has joined #commonlisp
notzmv has joined #commonlisp
splittist has joined #commonlisp
yazz has quit [Ping timeout: 248 seconds]
bpanthi978 has joined #commonlisp
bpanthi977 has quit [Ping timeout: 252 seconds]
g-gundam has quit [Ping timeout: 276 seconds]
bpanthi978 is now known as bpanthi977
g-gundam` has joined #commonlisp
dbotton has joined #commonlisp
nxtr has joined #commonlisp
mister_m has joined #commonlisp
rtypo has quit [Ping timeout: 272 seconds]
rbcarleton has quit [Remote host closed the connection]
rbcarleton has joined #commonlisp
|3b| has joined #commonlisp
fe[nl]ix has quit [Ping timeout: 252 seconds]
drmeister has joined #commonlisp
notzmv has quit [Ping timeout: 248 seconds]
leeb has joined #commonlisp
prokhor-zhakarov has quit [Remote host closed the connection]
mustafa has quit [Ping timeout: 268 seconds]
prokhor-zhakarov has joined #commonlisp
rtypo has joined #commonlisp
fe[nl]ix has joined #commonlisp
Eoco has quit [Ping timeout: 272 seconds]
mathrick has joined #commonlisp
yazz has joined #commonlisp
Eoco has joined #commonlisp
mustafa has joined #commonlisp
notzmv has joined #commonlisp
zephyr has joined #commonlisp
alfiee has joined #commonlisp
Gleefre has joined #commonlisp
apac has quit [Read error: Connection reset by peer]
fourier has joined #commonlisp
bigbookofbug has joined #commonlisp
pabs3 has joined #commonlisp
yacin has joined #commonlisp
treflip has joined #commonlisp
stylewarning has joined #commonlisp
mgl has joined #commonlisp
danza has quit [Remote host closed the connection]
bigbookofbug has quit [Quit: leaving]
bigbookofbug has joined #commonlisp
ixelp has quit [Ping timeout: 260 seconds]
ixelp has joined #commonlisp
donlcn has quit [Ping timeout: 276 seconds]
Guest47 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Gleefre has quit [Remote host closed the connection]
cage has joined #commonlisp
uhuh has quit [Remote host closed the connection]
manwithluck has joined #commonlisp
treflip` has joined #commonlisp
treflip has quit [Ping timeout: 248 seconds]
Guest47 has joined #commonlisp
Gleefre has joined #commonlisp
svm has joined #commonlisp
msv has quit [Ping timeout: 248 seconds]
<decweb>
Destructive functions are basically just reserving the right to mutate the input, there's no obligation to do so. It's the return value that's what is important.
iNomad has quit [Quit: leaving]
cage has quit [Remote host closed the connection]
eddof13 has joined #commonlisp
shawnw_ is now known as shawnw
samesame has joined #commonlisp
chomwitt has joined #commonlisp
zxcvz has joined #commonlisp
inline has joined #commonlisp
chomwitt has quit [Ping timeout: 252 seconds]
samesame has quit [Quit: Leaving]
rgherdt has quit [Ping timeout: 244 seconds]
<beach>
With one exception as I recall, but I can't remember which one.
<beach>
NCONC maybe?
donlcn has joined #commonlisp
eddof13 has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
treflip` has quit [Remote host closed the connection]
kiyafirs has joined #commonlisp
Oddity has joined #commonlisp
chomwitt has joined #commonlisp
g-gundam` is now known as g-gundam
g-gundam has quit [Changing host]
g-gundam has joined #commonlisp
<bike>
nconc is specifically defined to be destructive, yeah
chomwitt has quit [Ping timeout: 272 seconds]
decweb has quit [Quit: Konversation terminated!]
jistr has quit [Ping timeout: 252 seconds]
decweb has joined #commonlisp
kiyafirs has quit [Remote host closed the connection]
jistr has joined #commonlisp
cage has joined #commonlisp
kiyafirs has joined #commonlisp
chomwitt has joined #commonlisp
chomwitt has quit [Ping timeout: 272 seconds]
ebrasca has joined #commonlisp
Lycurgus has joined #commonlisp
varjag has joined #commonlisp
divya has quit [Ping timeout: 252 seconds]
jon_atack has quit [Ping timeout: 268 seconds]
pranav has quit [Remote host closed the connection]
rgherdt` has quit [Ping timeout: 252 seconds]
pranav has joined #commonlisp
viaken has quit [Quit: boop]
ol0ck_ has joined #commonlisp
ingeniot has joined #commonlisp
thuna` has quit [Ping timeout: 268 seconds]
apac has joined #commonlisp
<aeth>
Conses are weird when used mutably... I do understand the languages (e.g. Racket) that have decided not to make them mutable at all because 99% of the time, I work with lists immutably. Linked lists, built as a thin abstraction over conses, are only semi-reified and edge cases can show up. Yes, working with places (e.g. deletef) are the way to go.
<aeth>
You can also just wrap it in an object/struct of one slot if you need to.
pve has quit [Quit: leaving]
<aeth>
Mutable lists (or graphs from conses) are only useful in a weird middle ground between properly building nodes from OOP and just using vectors.
<aeth>
A quick and dirty script with a lot of middle insert/remove or something.
divya has joined #commonlisp
attila_lendvai has joined #commonlisp
ingeniot has quit [Ping timeout: 252 seconds]
cage has quit [Quit: rcirc on GNU Emacs 30.1]
younder has joined #commonlisp
donlcn has quit [Ping timeout: 268 seconds]
attila_lendvai_ has joined #commonlisp
attila_lendvai has quit [Read error: Connection reset by peer]
rgherdt has joined #commonlisp
stanrifkin has joined #commonlisp
chomwitt has joined #commonlisp
Guest47 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
donlcn has joined #commonlisp
mgl has quit []
zwr has quit [Ping timeout: 252 seconds]
zwr has joined #commonlisp
zxcvz has quit [Quit: zxcvz]
Lycurgus has quit [Quit: irc.renjuan.org (juan@acm.org)]
tuck has joined #commonlisp
apac has quit [Quit: Konversation terminated!]
rtypo has quit [Ping timeout: 248 seconds]
Gleefre has quit [Remote host closed the connection]
cow_2001 has quit [Quit: ✡]
Gleefre has joined #commonlisp
istewart has joined #commonlisp
stanrifkin has quit [Quit: Leaving]
cow_2001 has joined #commonlisp
patrix has quit [Quit: gone]
patrix has joined #commonlisp
istewart has quit [Quit: Konversation terminated!]
istewart has joined #commonlisp
varjag has quit [Ping timeout: 252 seconds]
decweb has quit [Quit: Konversation terminated!]
Gleefre has quit [Remote host closed the connection]
varjag has joined #commonlisp
phantomics has quit [Ping timeout: 245 seconds]
varjag has quit [Ping timeout: 276 seconds]
Oladon has joined #commonlisp
phantomics has joined #commonlisp
decweb has joined #commonlisp
akoana has joined #commonlisp
johnjaye has quit [Ping timeout: 248 seconds]
ebrasca has quit [Ping timeout: 265 seconds]
PuercoPop has quit [Changing host]
PuercoPop has joined #commonlisp
attila_lendvai_ has quit [Ping timeout: 272 seconds]
<decweb>
`rplaca` and `rplacd` are two other things which must mutate their argument to do their function.
<decweb>
On the topic of immutability, shameless plug for https://github.com/dtenny/clj-coll, which lets you deal with mutable CL and immutable clojure-like collections (and lazy sequences) all through uniform APIs. Unlike clojure, you have choices for mutable results.
<ixelp>
GitHub - dtenny/clj-coll: Clojure collection and sequence APIs in Common Lisp, with optional Clojure collection syntax
screwlisp has joined #commonlisp
akoana has quit [Quit: leaving]
Gleefre has joined #commonlisp
Gleefre has quit [Ping timeout: 240 seconds]
<screwlisp>
o/
<aeth>
decweb: on that note, the issue is usually not with `rplaca` or the near-equivalent `(setf car)`, but with messing with CDRs
<aeth>
although mutating a literal '(1 2 3 4) is problematic even with setting the car
<screwlisp>
This week, lots of notes ancillary to screwlisp.small-web.org I guess! Quickly turning "cli app" CLOS classes into guis with McCLIM, my gnuplot function on NZ climate per-day raw data, ams setting me straight about the loop facility yet again. Coming up in half an hour.
<screwlisp>
aeth are you pointing out that '(1 2 3 4) is a constant literal or w/e
<screwlisp>
And so the fact that (let ((l '(1 2 3 4))) (rplaca l 'a) (values l)) works is a weird vibe?