endobson has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dddddd has quit [Remote host closed the connection]
ermo has quit [Ping timeout: 246 seconds]
endobson has joined #racket
ermo has joined #racket
endobson has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FreeFull has quit []
Codaraxis_ has joined #racket
Codaraxis has quit [Ping timeout: 248 seconds]
wingsorc has quit [Quit: Leaving]
badkins has quit [Remote host closed the connection]
endobson has joined #racket
badkins has joined #racket
endobson has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Codaraxis_ has quit [Read error: Connection reset by peer]
badkins has quit [Ping timeout: 245 seconds]
ArneBab has joined #racket
orivej has joined #racket
laduke has joined #racket
<laduke>
hey i'm trying to center some text, so I need the width of the text. I think get-text-extent is the thing to use, but it returns multiple values? I haven't seen that yet. How do I get the first value?
<laduke>
figured something out with let-values
narimiran has joined #racket
Trieste has joined #racket
endformationage has quit [Quit: WeeChat 2.6]
sauvin has joined #racket
sauvin has quit [Max SendQ exceeded]
sauvin has joined #racket
pera has quit [Ping timeout: 272 seconds]
Sgeo has quit [Read error: Connection reset by peer]
Sgeo has joined #racket
tilpner_ has joined #racket
tilpner has quit [Ping timeout: 268 seconds]
Codaraxis_ has joined #racket
libertyprime has joined #racket
<dzoe>
laduke: let-values or define-values is your friend
soegaard has joined #racket
cbarrett has quit [Ping timeout: 248 seconds]
greghendershott has quit [Ping timeout: 248 seconds]
^[ has quit [Ping timeout: 248 seconds]
samth has quit [Ping timeout: 248 seconds]
siel has quit [Ping timeout: 248 seconds]
cbarrett has joined #racket
greghendershott has joined #racket
vegai has joined #racket
samth has joined #racket
^[ has joined #racket
siel has joined #racket
orivej has quit [Ping timeout: 240 seconds]
sagax has joined #racket
lockywolf has joined #racket
orivej has joined #racket
Codaraxis__ has joined #racket
Codaraxis__ has quit [Remote host closed the connection]
Codaraxis_ has quit [Ping timeout: 260 seconds]
wingo has joined #racket
libertyprime has quit [Quit: leaving]
Fernando-Basso has joined #racket
iyzsong has joined #racket
soegaard has quit [Quit: soegaard]
soegaard has joined #racket
badkins has joined #racket
badkins has quit [Ping timeout: 260 seconds]
soegaard has quit [Quit: soegaard]
Trieste has quit [Ping timeout: 272 seconds]
Trieste has joined #racket
orivej has quit [Remote host closed the connection]
m1dnight_ has quit [Remote host closed the connection]
m1dnight_ has joined #racket
m1dnight_ has quit [Quit: WeeChat 2.4]
vraid has joined #racket
dddddd has joined #racket
soegaard has quit [Quit: soegaard]
nullcone has quit [Quit: Connection closed for inactivity]
Naptra has quit [Remote host closed the connection]
Naptra has joined #racket
acarrico has joined #racket
badkins has joined #racket
orivej has joined #racket
badkins has quit [Remote host closed the connection]
badkins has joined #racket
badkins has quit [Remote host closed the connection]
badkins_ has joined #racket
Fare has joined #racket
Fare has quit [Ping timeout: 240 seconds]
soegaard has joined #racket
badkins_ has quit [Remote host closed the connection]
soegaard has quit [Quit: soegaard]
Fare has joined #racket
badkins has joined #racket
badkins has quit [Remote host closed the connection]
badkins has joined #racket
badkins has quit [Remote host closed the connection]
badkins has joined #racket
manualcrank has joined #racket
pera has joined #racket
vraid has quit [Quit: Leaving]
gour has quit [Remote host closed the connection]
KDr2 has quit [Quit: Connection closed for inactivity]
badkins has quit [Remote host closed the connection]
badkins has joined #racket
badkins has quit [Ping timeout: 258 seconds]
endformationage has joined #racket
nullcone has joined #racket
orivej has quit [Ping timeout: 255 seconds]
FreeFull has joined #racket
<laduke>
Is there a way to not bind all 4 variables, if I'm only using the first? (let-values ([(a _b _c _d)...
<greghendershott>
laduke: No, but your example follows the naming convention that the rest aren't used.
<greghendershott>
I mean, you could use `call-with-values` to get a list and then bind only the `car` or `first` to something.
<technomancy>
you can't do something like (a . _) ?
<greghendershott>
But I wouldn't worry about the "excess" bindings.
Fare has quit [Ping timeout: 258 seconds]
<greghendershott>
technomancy: AFAIK, no. It would be nice if `match` forms supported `values`, then you could do something like what you suggest.
<technomancy>
values are frustratingly not-quite-lists =(
<technomancy>
fennel does this by binding (a b c) to values and [a b c] to lists
<greghendershott>
Yes. The only "glue" for that is `call-with-values`, which is the only _necessary_ thing, just not very ergonomic
<technomancy>
I'm still of the opinion that multiple-values solves the same problem as pattern matching but in a worse way
soegaard has joined #racket
<greghendershott>
`(match (call-with-values (λ () (values 1 2 3 4)) list) [(list* a b _) _do something with a and b_])` meh
<greghendershott>
AFAIK you can't write a match expander for this b/c they expect a single value.
<greghendershott>
And writing a match _expander_ is best b/c it works with all match variations.
<greghendershott>
Anyway if "excess bindings" bother you I recommend not looking at fully-expanded programs :P
<technomancy>
is multiple values just one of those things we're stuck with for historical reasons like the class system?
<greghendershott>
I think of it as something basic inherited from Scheme, as opposed to an "add-on" like racket/class. So, if "stuck", stuck for different reasons.
<technomancy>
yeah, makes sense
<technomancy>
that quip about "stripping away features that seem necessary" kinda comes back to bite you when it comes to multi-values
<technomancy>
yeah, I'm familiar with that argument. it's tidy, but it doesn't jive with how code is actually written.
<greghendershott>
I think boxing return values as lists or whatever is slightly slower, but that's not necessarily a deal-breaker.
<greghendershott>
I think the main issue is how many things already return multiple values, and who rewrites all this, and who wants to use that.
<technomancy>
it's slower with the optimizations that currently exist; if the language were designed from the ground up with pattern matching against lists as a core idiom, I expect the optimizations we would have today would make them roughly equivalent.
<technomancy>
yeah, hence ... historical baggage.
<greghendershott>
So maybe it's best saved for Racket's "Python 3" someday where everything gets blown up.
<technomancy>
haha
srji has quit [Quit: leaving]
<greghendershott>
I'd prefer Schrödinger values where the return arity isn't known until you call it.
<greghendershott>
That would be language innovation as opposed to all this bike-shedding :D
<technomancy>
Fennel has multiple values too but I'm struggling to think of any time I've seen it used for something other than either error state or x/y coordinates
<technomancy>
and it works seamlessly with match, so it's less of a problem
C79 has joined #racket
sauvin has quit [Read error: Connection reset by peer]
teardown has quit [Ping timeout: 268 seconds]
MustardCheese has joined #racket
<C79>
does anyone have a moment to help me on something simple that I can't figure out
endforma1 has joined #racket
endformationage has quit [Ping timeout: 240 seconds]
badkins has joined #racket
orivej has joined #racket
badkins has quit [Ping timeout: 268 seconds]
C79 has quit [Remote host closed the connection]
<technomancy>
aw they left =(
badkins has joined #racket
badkins has quit [Remote host closed the connection]
badkins has joined #racket
acarrico has quit [Ping timeout: 265 seconds]
soegaard has quit [Quit: soegaard]
pera has quit [Ping timeout: 260 seconds]
soegaard has joined #racket
m1dnight_ has joined #racket
<MustardCheese>
A shame
Fare has joined #racket
pera has joined #racket
narimiran has quit [Ping timeout: 272 seconds]
MustardCheese has quit [Ping timeout: 260 seconds]
<laduke>
thanks for all the above! I'm used to a linter in a different language yelling at me for unused variables. If that's normal in racket, then OK.
efm has joined #racket
Naptra has quit [Remote host closed the connection]
vraid has joined #racket
acarrico has joined #racket
efm has quit [Ping timeout: 268 seconds]
pera has quit [Quit: leaving]
efm has joined #racket
<nisstyre>
I've never seen Racket complain about dead code or unused variables
acarrico has quit [Ping timeout: 255 seconds]
orivej has quit [Ping timeout: 240 seconds]
<technomancy>
greghendershott: the other thing about that article you posted is that I think it makes a much more compelling case for curried functions (every function takes exactly one argument and returns exactly one value) than it does for multiple values
<technomancy>
I don't really understand the explanation of why (+ (values 1 2)) doesn't work
<technomancy>
ah never mind; reading further helps clear that up
<technomancy>
it seems like a red flag if you have to understand continuations in order to get how return values works tho??