<Yaargh>
how can i grab the first element of foo and the second
<Yaargh>
?
<Yaargh>
for use in the place-image
<Yaargh>
i dont want to use make-posn btw
<Yaargh>
i tried (first) but it expects a list
<Yaargh>
<- beginner
badkins has joined #racket
confusedwanderer has joined #racket
<vraid>
Yaargh: try (coords-X foo) and (coords-Y foo)
<Yaargh>
thanks!
<Yaargh>
i had tried variations of (foo foo-x)
<Yaargh>
so close...
dbmikus has joined #racket
badkins_ has joined #racket
Yaargh has quit [Quit: Going offline, see ya! (www.adiirc.com)]
badkins has quit [Ping timeout: 268 seconds]
<jcowan>
lexi-lambda: Read your post on multimethods in Racket
<jcowan>
It occurred to me that the global mutation could be removed by making the lookup tables persistent rather than mutable; a package would then export a modified generic function rather than modifying a global one.
<jcowan>
Then a method to merge generic functions (again non-destructively) would deal with importing two of the same name from different modules
pierpal has quit [Quit: Poof]
pierpal has joined #racket
pera has joined #racket
rnmhdn has joined #racket
dddddd has joined #racket
pierpal has quit [Quit: Poof]
pierpal has joined #racket
rain1 has joined #racket
rnmhdn has quit [Ping timeout: 250 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #racket
vraid has quit [Quit: Leaving]
badkins has joined #racket
badkins_ has quit [Ping timeout: 250 seconds]
abhishiv has left #racket [#racket]
baldfat has quit [Ping timeout: 268 seconds]
rnmhdn has joined #racket
ziyourenxiang has quit [Ping timeout: 268 seconds]
capisce has left #racket [#racket]
<lexi-lambda>
jcowan: I am skeptical that would be a very pleasant interface to use in practice
badkins has quit [Ping timeout: 246 seconds]
<jcowan>
well, yes, you always work harder with immutable stuff I suppose
groovy2shoes has quit [Quit: moritura te salutat]
nuclearkev has joined #racket
ng0 has quit [Remote host closed the connection]
ng0 has joined #racket
buyfn has joined #racket
hjek has joined #racket
nuclearkev has quit [Ping timeout: 268 seconds]
acarrico has quit [Ping timeout: 246 seconds]
abhishiv has joined #racket
abhishiv has left #racket [#racket]
rnmhdn has quit [Ping timeout: 250 seconds]
badkins has joined #racket
nuclearkev has joined #racket
buyfn has quit [Quit: buyfn]
hjek has quit [Quit: Leaving.]
buyfn has joined #racket
rnmhdn has joined #racket
nuclearkev has left #racket ["ERC (IRC client for Emacs 26.1)"]
rnmhdn has quit [Ping timeout: 250 seconds]
orivej has quit [Ping timeout: 246 seconds]
rnmhdn has joined #racket
audriu has joined #racket
rnmhdn has quit [Ping timeout: 268 seconds]
sleepnap has joined #racket
sauvin has quit [Read error: Connection reset by peer]
dan_f has joined #racket
libertyprime has quit [Ping timeout: 250 seconds]
abhishiv has joined #racket
orivej has joined #racket
badkins has quit [Ping timeout: 250 seconds]
pera has quit [Ping timeout: 246 seconds]
pera has joined #racket
buyfn has quit [Quit: buyfn]
badkins has joined #racket
confusedwanderer has quit [Quit: confusedwanderer]
gour has quit [Remote host closed the connection]
mzan has left #racket [#racket]
audriu has quit [Quit: Leaving]
badkins has quit []
Yaargh has joined #racket
sz0 has joined #racket
<Yaargh>
say i had a struct (person x y) and i wanted to mutate the first variable. eg - (sub1 (person-x person)) <-- doesnt work
<Yaargh>
proper way to do this?
<Yaargh>
well i have found the #:mutable flag
<lexi-lambda>
Yaargh: sub1 doesn’t mutate anything, it just returns a new number. So don’t mutate it—instead, construct a new struct. Do (person (sub1 (person-x person)) (person-y person)), and use that instead of the old one. (Structs in Racket are immutable by default and always immutable in BSL/ISL.)
<Yaargh>
i see
<Yaargh>
i will do it your way but for curiosly the mutable flag is giving me an error. For example: (define-struct dog (breed colour) #:mutable) results in:
<Yaargh>
define-struct: expected nothing after the field names, but found 1 extra part
<Yaargh>
using ASL
<lexi-lambda>
Then I guess ASL also doesn’t support mutable structs; I wasn’t sure about it.
<Yaargh>
must be a way to enable in the preferences?
<lexi-lambda>
Yaargh: Actually reading the documentation for define-struct in ASL, it looks like it does allow mutation of structures, implicitly. It says: “In Advanced, define-struct introduces one additional function, set-structure-name-field-name!, which takes an instance of the structure and a value, and mutates the instance’s field to the given value.”
<Yaargh>
good to know
ubLIX has joined #racket
orivej has quit [Ping timeout: 268 seconds]
Yaargh has quit [Quit: Going offline, see ya! (www.adiirc.com)]
lf94 has joined #racket
<lf94>
had this long typed lambda calculus talk with a friend. did some googling. racket is exploding my head.
nyaacarD has quit [Remote host closed the connection]
sleepnap has left #racket [#racket]
abhishiv has quit [Ping timeout: 246 seconds]
dbmikus has quit [Ping timeout: 250 seconds]
hjek has joined #racket
pie__ has quit [Remote host closed the connection]